In what must rank amongst the most shocking political comebacks of all time, the Australian prime minister Julia Gillard has been defeated in a snap leadership election by the man she originally ousted, Kevin Rudd.
Australian media reports that Rudd won the ballot 57 votes to 45. Several ministers have also quit the government.
Gillard toppled Rudd in a leadership challenge in 2010, but the party looks set to suffer a crushing defeat in the September elections.
Leaving the chamber where the ballot was held, Gillard told reporters: "Three years ago I had the honour of being elected Labor leader.
"This privilege was truly humbling. I thank the Labor Party for that privilege and I thank the Australian people for their support."
"I'm confident I leave the prime ministership having strengthened our relationship with our partners, all of them."
She hoped she has left a legacy for the country's next female Prime Minister, she said. "There's been a lot of analysis about the so called gender wars.
"Me playing the so-called gender wars because heavens knows no one noticed I was a woman until I raised it....The reaction to being the first female prime minister does not explain everything about me prime ministership, nor does it explain nothing about my prime ministership."
"What I am absolutely confident of is it will be easier for the next woman and the woman after that and the woman after that and I'm proud of that."
Gillard said earlier that she was looking for closure on the issue: "I have been in a contest with the leader of the opposition, but I've also been in a political contest with people from my own political party.
"We cannot have the government or the Labor Party go to the next election with a person leading the Labor Party and a person floating around as the potential alternate leader.
"Anybody who enters the ballot tonight should do it on the following conditions: that if you win you're Labor leader, that if you lose you retire from politics."
"This is it, tonight is the night. I wouldn't be putting myself forward unless I had a degree of confidence."
Australian prime mInister Julia Gillard (C) and supporters enter the caucus room for the leadership ballot at Parliament House
Rudd defended challenging Gillard at such a turbulent time for the party. "For the nation's sake it is time for this matter to be resolved. We are on course for a catastrophic defeat unless there is change," he added.
Opposition leader Tony Abbott has called on the government to move the election forward to August, because of the "paralysis" in leadership.