Sweden made history by naming its first-ever female Prime Minister but the appointment was only good for a couple of hours.

Magdalena Andersson was appointed in a monumental move but the 54-year-old ended up resigning after her coalition partner quit the government aside from her budget failing to pass, BBC reported.

Rather than approve her budget, parliament ended up voting for a budget drawn up by the opposition. Among those who voted include the anti-immigrant far-right.

Andersson told the speaker that she wished to resign and it appears the move was tied to the budget issue. She was aligned with the Green Party who could not accept a budget "drafted for the first time with the far-right".

However, the appointment and then resignation does not mean that Andersson is closing the door. She plans to try again in the future to become prime minister but as a single-party government leader.

"There is a constitutional practice that a coalition government should resign when one party quits," the Social Democrat said on Wednesday, Nov. 24. "I don't want to lead a government whose legitimacy will be questioned.”

Andersson was elected on Wednesday since, under Swedish law, she only needed a majority of MPs not to vote against her, CNN reported.

Of the 349 members of the Riksdag, 174 voted against her. But on top of the 117 MPs who backed Ms. Andersson, a further 57 abstained, giving her victory by a single vote.

Andersson is a former junior swimming champion from the University City of Uppsala. She started her political journey in 1996, serving as political adviser to former Prime Minister Goran Persson. In the last seven years, the 54-year-old has served as finance minister.

She previously worked as deputy director-general of the Swedish Tax Agency according to the Swedish government website.

Before MPs backed Magdalena Andersson, Sweden was the only Nordic state ever to have a woman as PM.

Sweden's Minister of Finance Magdalena Andersson Sweden's Minister of Finance Magdalena Andersson Getty Images | HENRIK MONTGOMERY/TT News Agency/AFP