A Brazilian audit court has ruled that President Dilma Rousseff broke the law in managing last year's budget.
The government was accused of borrowing money illegally from state banks to make up for budget shortfalls.
The opposition says the ruling by the Federal Accounts Court - which reports to Congress - paves the way for impeachment proceedings against Ms Rousseff.
She was re-elected less than a year ago but has record low popularity ratings.
The Brazilian government says it would challenge Wednesday's ruling in the Supreme Court.
"The game is not over," said Attorney General Luis Adams.
The minister who handled the case in the Accounts Court, Augusto Nardes, said the government disregarded fiscal and constitutional principles in the handling of the 2014 accounts.
Ms Rousseff's government raised spending "without fiscal sustainability and without the required transparency", said Mr Nardes.
The irregularities amount to more than $26bn (£17bn; 100 billion reais), according to the court.
Recession and corruption
If the decision is upheld by the Supreme Court, the government's accounts will then be assessed by the Congress, where Ms Rousseff's coalition has a majority.
This is the latest in a series of setbacks for Ms Rousseff.
On Tuesday, Brazil's top electoral authority said that it would re-open an investigation into alleged misuse of funds during Ms Rousseff's re-election campaign.
The Supreme Electoral Court will try to determine if Ms Rousseff's and Vice-President Michel Temer's campaign drew on donations from illegal sources.
The probe was requested by the opposition PSDB party.
The Brazilian economy has gone into recession and is expected to shrink by 3% this year.
The government's popularity has fallen amid corruption scandals involving senior politicians from Ms Rousseff's Worker's Party and other coalition members.