The Supreme Court ruled Friday that people can sue in federal court if they believe state or local governments have infringed on their property rights, siding with a Pennsylvania woman fighting her town over a supposed cemetery on her land.

In a 5-4 decision, the court ruled in favor of Rose Mary Knick, who tried to bring a lawsuit in federal court after her town, Scott, Pennsylvania, passed an ordinance that required anyone with a cemetery on their land to open it to the public during the day.

SUPREME COURT THROWS OUT MURDER CONVICTION OF BLACK INMATE AS KAVANAUGH, GORSUCH SPLIT AGAIN

Chief Justice John Roberts delivered the court’s opinion in Knick v. Township of Scott, saying that a person attempting to sue their town finds themselves in a “Catch-22.”

“He cannot go to federal court without going to state court first; but if he goes to state court and loses, his claim will be barred in federal court,” Roberts wrote, adding that “we now conclude that the state-litigation requirement imposes an unjustifiable burden” on the property owner.

In this case, a town official found several grave markers on Knick’s farmland in Pennsylvania, but she disputed whether there was actually a small, family cemetery on her property.

Knick argued that in passing the ordinance in 2012 and applying it to her, local officials were essentially taking her property and opening it to the public without paying her for it.

A federal court threw out Knick’s case, ruling that she had to go to state court first.

Because of the Supreme Court’s ruling, Knick will now be able to pursue her case in federal court.

Knick’s attorneys argued that property owners with complaints like Knick’s would often prefer to take their cases to federal court because they may view them as more objective than in state courts, which they said could be seen as being influenced by local politics.

SUPREME COURT RULES PEACE CROSS WAR MEMORIAL CAN STAND

“This decision is a very long time coming for Rose and other property owners who have had federal courtroom doors slammed shut in their faces whenever they seek compensation for a governmental taking of their private property,” Knick’s attorney J. David Breemer said in a statement.

Prior to the ruling on Friday, local governments had the power to take a case like Knick’s that was filed in state court and move it to federal court, but citizens did not have the option to begin their cases at the federal level.

A 1985 Supreme Court decision had barred people with property rights claims, like Knick’s, from going to federal court.

The Supreme Court’s Friday ruling overruled that decision, writing that it was “not just wrong” but also “exceptionally ill founded.”

Meanwhile, Justice Elena Kagan, in a dissent for herself and her liberal colleagues, criticized her conservative colleagues for overruling the prior case, referencing a dissenting opinion written by Justice Stephen Breyer last month in another case where the court split on ideological lines in overturning a precedent. Breyer wrote that decision “can only cause one to wonder which cases the Court will overrule next.”

“Well that didn’t take long,” Kagan wrote. “Now one may wonder yet again.”

The Associated Press contributed to this report.