Kevin Rudd has been sworn in as the new Australian prime minister, after ousting Julia Gillard as Labor chief in a dramatic ballot.
Rudd's promotion on Thursday marks a stunning turnaround for the former leader who will now lead the party to elections scheduled for September 14.
Rudd won the vote of Labor lawmakers 57 to 45 amid mounting unease in the party over an expected rout by Tony Abbott's conservative opposition at the national polls in September.
On Thursday, Gillard's Transport Minister Anthony Albanese was sworn in as Rudd's deputy by Governor General Quentin Bryce while former Immigration Minister Chris Bowen was appointed treasurer.
Gillard, who announced she will retire from politics in September, had deposed Rudd in 2010.
There's been an erosion of trust; negative, destructive personal politics has done much to bring dishonour to our parliament.
All this must stop.
Gillard made a late-night visit to Bryce to offer her resignation and recommend Rudd be reinstated as prime minister, three years and two days after he was dumped by the party.
Analysts said Rudd may move the election date forward to August, hoping to capitalise on a bounce in the polls and build on his previous vows to reorient Australia's resources-fuelled economy towards the Asia-Pacific region.
"In 2007, the Australian people elected me to be their prime minister. That is a task that I resume today with humility, with honour and with an important sense of energy and purpose," said Rudd after his victory.
"In recent years politics has failed the Australian people, there's just been too much negativity all round. There's been an erosion of trust; negative, destructive personal politics has done much to bring dishonour to our parliament.
"All this must stop."
At a pre-ballot news conference, Rudd said he had been persuaded by MPs and "thousands" of ordinary Australians demanding he challenge Gillard "because of the parlous circumstances we now face".
Gillard dispatched her rival in a 2010 party room coup but he remains popular with the public and is seen by many as Labor's best hope of salvaging the elections, despite a series of policy missteps leading to his ousting three years ago.
Making his pitch ahead of the caucus vote, Mandarin-speaking Rudd, 55, said Labor was "on course for a catastrophic defeat unless there is change" and the people of Australia had made their feelings known.
Gillard's power tested
It was the third time since the 2010 election that Gillard's hold on power was tested.
Rudd himself launched an unsuccessful challenge in early 2012 while foreign minister, but was routed 71 votes to 31 and was forced onto the backbenches.
Then in March this year, Labor elder statesman Simon Crean made an abortive attempt to reinstall Rudd, who refused to stand and said at the time he would not challenge Gillard "under any circumstances".
In confirming he would challenge Gillard, Rudd vowed to rebuild the faction-riven Labor Party.
"Every effort I have in my being will be dedicated to uniting the Australian Labor Party," he said. "No retributions, no paybacks, none of that stuff. It's pointless, it's old politics."
Gillard will not be around to hinder him, announcing before the vote that she would retire at the elections if she lost.
Since assuming power, Australia's first female prime minister endured near-constant speculation about her leadership.
She won only the narrowest of victories in the 2010 election, resulting in a hung parliament which forced her to cobble together a minority government with the support of independents.
In announcing her retirement, Gillard said Labour could still win the election by "putting the divisions of the past behind us and uniting as a political party", adding that it had been "truly humbling" to serve as leader.
"I thank the Labor Party for that privilege and I thank the Australian people for their support."
Parliament was due to adjourn on Thursday night for the last time before the national polls, so any ballot had to be held before the legislative body disbanded.