(Reuters) - Shares of Fannie Mae and Freddie Mac tumbled more than 30 percent on Tuesday after a U.S. appeals court shut down efforts by hedge funds and other investors to pursue numerous legal claims accusing the U.S. government of seizing their profits following taxpayer bailouts.

A stands outside Fannie Mae headquarters in Washington February 21, 2014. REUTERS/Kevin Lamarque

By a 2-1 vote, the U.S. Circuit Court of Appeals for the District of Columbia said a lower court had correctly barred claims that the government overstepped its authority in 2012 by eliminating dividend payouts to various shareholders and requiring the companies to pay the U.S. Treasury an amount equal to their quarterly net worth.

“For me, it looks like the end of the road,” Ellis Phifer, senior market strategist at Raymond James in Memphis, Tennessee, said of the hedge funds’ claim.

The court said Fannie Mae and Freddie Mac investors could still pursue some damages claims, including for breach of contract.

The plaintiffs could also appeal the ruling, possibly sending the case to the U.S. Supreme Court.

Still, stock traders viewed the decision as a setback. Hedge fund Perry Capital was among those that sought to challenge the lower court’s dismissal of lawsuits, arguing the government’s confiscation of profits was illegal.

In afternoon trading on above-average volume, Fannie Mae shares were down 33 percent at $2.78, while Freddie Mac fell 36 percent to $2.54. Both stocks are still up by about two-thirds since Donald Trump won the U.S. presidential election on Nov. 8. Investors said part of that rally stemmed from comments that month by then-Treasury Secretary-nominee Steve Mnuchin that both companies should be privatized.

Mnuchin, however, said in January he was against such a plan.

In an unusual joint majority decision, Circuit Judges Patricia Millett and Douglas Ginsburg said the government had the authority under a 2008 law that laid the groundwork for its seizure of the two companies.

Both companies have since become profitable under the conservatorship of the Federal Housing Finance Agency. According to court papers, they have returned roughly $68 billion more to the government than they drew down during the financial crisis.

Circuit Judge Janice Rogers Brown dissented, accusing the FHFA of improperly exercising a “stunningly broad view of its own power” as a conservator.

Major owners of the companies’ preferred stock include Bruce Berkowitz’s Fairholme Funds Inc, while William Ackman’s Pershing Square Capital Management has a large stake in their common shares.

In January, Ackman told investors that shares of the two companies could continue to rise. Prior to Tuesday, they had helped the billionaire investor start 2017 with gains after two years of losses.

A lawyer for Perry Capital said the fund, which had been a prominent hedge fund before suffering steep losses and deciding last year to shut down, would consider an appeal.

“While we disagree with the majority analysis... we are gratified to have our breach of contract claims go forward as part of the class action,” said Matthew McGill, an attorney at Gibson Dunn.

Analysts said the ruling was consistent with others on FHFA’s guardianship of Fannie and Freddie, making it less likely the Supreme Court would take the case.

“It doesn’t seem to be a constitutional issue,” said Bose George, an analyst at Keefe, Bruyette & Woods in New York.