A federal judge has ruled that Pennsylvania unfairly treats its third-party political candidates, likely clearing the way for their return to the ballot after nearly disappearing during recent election cycles.

In an opinion released Friday, U.S. District Judge Lawrence Stengel wrote that the ability of minor parties to organize and speak out "has been decimated" by portions of the state's election code.

Specifically, Stengel took issue with a rule that has forced third-party candidates to gather many times the number of signatures required of Republicans or Democrats - and then pay as much as $100,000 in legal fees when their petitions are challenged.

Those burdens have together had a "chilling effect" on third-party candidates seeking office, the judge wrote, "demonstrated by the disappearance of minor parties from the general election ballot."

Last November, Pennsylvania was one of four states whose statewide ballots lacked independent or third-party candidates, said Richard Winger, editor of the website Ballot Access News. "I don't think Pennsylvanians realize they're in there with Alabama and New Mexico and California," he said. "It's a big deal."

But how the ruling could impact third-party candidates in Pennsylvania remains to be seen, particularly in 2016, political observers say.

Independents often run in presidential races, but candidates H. Ross Perot and Ralph Nader failed to affect Pennsylvania's vote in 1992 or 2000, said G. Terry Madonna, the Franklin and Marshall College political scientist and pollster.

"I'm not going to say it's impossible to have some effect," he said. "But I'm still relatively unconvinced."

The lawsuit was brought by the state chapters of three national groups: the left-leaning Green Party, the Libertarian Party, and the conservative-leaning Constitution Party. They sued in 2012 over the cumulative impact of the signature requirements and related costs that they said had stopped them from filing nomination papers for positions that included governor and president.

Under current code, Pennsylvania says independent candidates who want to be on the ballot must collect enough signatures to match at least 2 percent of the votes cast for the top vote-getter in the last statewide election - a number that has been as high as 70,000.

By contrast, Republicans and Democrats need only 2,000 signatures to get on the ballot.

Pennsylvania is also the only state where the courts - and not an executive agency - verify a candidate's ballot petitions. That means candidates here must pay court costs to defend their signatures' validity, which can add up to as much as $50,000. And they could also be ordered to cover the challenger's legal costs, bringing the price of trying to run to more than $100,000.

That happened to Carl Romanelli, a Green Party candidate from Wilkes-Barre who wanted to run for U.S. Senate in 2006 but whose petitions were challenged.

"This is amazing," Romanelli said after hearing about the ruling Friday. "This may mean there's a candidacy in my future, but I really haven't decided yet. The last one took a lot out of me."

Stengel, who sits in Philadelphia, had initially dismissed the lawsuit over the election code. But a federal appeals court ordered him to reconsider.

Oliver Hall, an attorney representing the political parties, said the ruling means state legislators will likely have to make statutory changes to the election code. Until then, and in a move that could take affect for the 2016 presidential election, the Department of State will likely have to issue guidelines.

"The harm was not just to these candidates but to all Pennsylvania voters who had no choice but to vote for a Republican or a Democrat," said Hall, director of the Center for Competitive Democracy in Washington. "And if there's one thing voters should have when they get to the polls is, it's a meaningful choice of candidates."

The Pennsylvania Department of State, the main defendant in the lawsuit, is reviewing the ruling, said spokeswoman Wanda Murren.

For the Constitution Party of Pennsylvania, the ruling means 2016 will likely be its first election since 2000 with a nominee on the ballot, said state Chairman Bob Goodrich.

In 2012, the state party collected 36,000 signatures - it only needed 21,000 - to put its presidential candidate on Pennsylvania's ballot. But it withdrew the name following challenges over the signatures.

"As a party, we just don't have that kind of money," Goodrich said. "But we do want to influence politics, no different than anybody else."