A Michigan Circuit Court Judge ruled Friday that Detroit's bankruptcy filing is unconstitutional and ordered the case be withdrawn from federal bankruptcy court.

But Michigan Attorney General Bill Schuette said in a statement soon after the decision that he intended an immediate appeal to the Michigan Court of Appeals and would seek to block this latest order from taking effect while the appeal is heard.

The order came in response to motions by lawyers for retirees and pension funds for city workers, who argue the state constitution prohibits cutting pension and retirement benefits, as has been proposed in the bankruptcy case.

Related: Detroit files bankruptcy

The order was from Ingham County Circuit Judge Rosemarie Aquilina, the county that includes the state capital of Lansing. Aquilina had been ready to issue an order Thursday that would have blocked the filing in federal bankruptcy court, but the hearing on the motion to do so started five minutes after the bankruptcy case was filed.

Related: Detroit bankruptcy filing came with only 5 minutes to spare

It's not clear if a state court judge legally can order a party in a federal case to drop that action.

"Obviously there are constitutional issues," said Michael Sweet, a bankruptcy attorney with the California law firm of Fox Rothschild and an expert in municipal bankruptcy cases. "Anyone who thought this case would be resolved quickly was sorely mistaken. There is too much at stake for too many people. Clearly the gloves are coming off."

Detroit became the largest municipal bankruptcy in U.S. history Thursday evening when emergency manager Kevyn Orr filed the case in federal bankruptcy court in Detroit. Orr had been appointed to oversee Detroit's finances by Gov. Rick Snyder. Snyder authorized the bankruptcy filing. Aquilina's order says that Snyder must now order Orr to withdrawal the case.

The American Federation of State, County and Municipal Employees, a union opposed to the bankruptcy filing, praised the judge's ruling.

"There is too much at stake to play political games with the hard-earned retirement security of Detroit's public workers," union president Lee Saunders said in a statement.

CNNMoney's James O'Toole contributed reporting.