Political powerbroker Bill Shorten played a key role in ousting two Australian prime ministers — both members of his own party and politicians he had once supported. That history of fickle loyalty may come back to haunt him as he seeks to lead the country.

Shorten is leading the center-left Labor Party in the July 2 general election, and his opponents in the conservative Liberal Party hope to exploit his connections to the dysfunction of recent Labor governments.

He was part of a party coup that replaced Prime Minister Kevin Rudd with his deputy Julia Gillard in 2010, after which he was rewarded with a promotion to her Cabinet. But by 2013, Shorten's allegiance had swung back behind Rudd, who ousted Gillard to become prime minister once again, three months before Labor lost in elections.

A Liberal Party online ad depicts Shorten as a weather vane with outstretched fists holding daggers and accuses him of "knifing" two prime ministers. It features his declarations of support for Gillard, then Rudd, in various broadcast interviews.

Shorten ended a recent economic speech to Parliament with a commitment not to repeat Labor's past mistakes.

"We have learned the hard lessons of the past. We have put forward our positive plans. We are united. We are ready. A Labor government will always put people first," he said.

After the 2013 election, Shorten was chosen as opposition leader and his Labor colleagues have shown discipline by publicly banding behind him. The party remains divided over their treatment of the two former prime ministers, both of whom have since retired from politics.

"I know that Bill Shorten has spent his working life looking after the interests of working people and he is still looking after the interests of working people in his job as leader of the opposition," senior Labor lawmaker Mark Dreyfus said in an interview last year.

And while the conservatives promised a return to stable government at the last election, they've endured a leadership shakeup with some similarities to Labor's. Prime Minister Tony Abbott's tenure was shorter than that of either Rudd or Gillard before he was torn down by colleagues spooked by bad opinion polling. Prime Minister Malcolm Turnbull, whom Abbott had ousted as party boss in 2009, took over in September.

Turnbull's government has dubbed Shorten "Electricity Bill" because he was a senior part of the former Labor government that imposed an unpopular carbon tax that inflated electricity prices during its last six years in power. The tax has been repealed.

Another Liberal Party ad reminds voters that Labor inherited a record budget surplus but left a record debt. Economists, however, have widely praised Labor for its timely stimulus spending that blew the budget but also saved Australia from recession during the global economic crisis. Debt has continued to mount under the current government.

Opinion polls show Labor and the Liberal Party essentially tied, but that voters prefer Turnbull over Shorten as prime minister. While Australians don't directly elect their prime minister, history has shown that distrust of leaders can cost their parties votes.

Shorten, 48, was first elected to Parliament in the same 2007 election that swept Labor to power for the first time in more than 11 years under Rudd.

Shorten has deep labor-union roots. His father was a waterside laborer and union official and his mother was a lawyer and university academic. He became involved in Labor politics as a student and was soon touted as a potential prime minister. He worked for less than two years as a lawyer before becoming a union official.

Shorten first came to national attention as national secretary of the Australian Workers Union in 2006 when the Beaconsfield gold mine collapse in Tasmania state killed one miner and left two trapped underground for two weeks.

His regular press conferences on behalf of the union representing the miners created a national profile before he entered Parliament the following year.

Shorten was last year called to defend his actions as a union official before a top-level government-commissioned inquiry into union corruption called a royal commission. Labor condemned it as a politically motivated witch hunt.

During two days in the witness box, Shorten rejected suggestions by royal commission lawyers that he had had conflicts of interests when companies made donations to his union while he was negotiating with them contracts on their employees' pay. He was criticized over news of the donations, even from within Labor ranks.

Royal Commissioner Dyson Heydon reported in December that union corruption was "widespread" and "deep-seated" in Australia. He found numerous examples of union money being misused and cited blackmail, bribery and threats of violence as crimes allegedly committed by union officials. Several union officials were referred to police for further investigation.

The royal commission made no adverse findings against Shorten, but Heydon made scathing comments about a deal Shorten's union struck with cleaning company Cleanevent in 2004. There was no evidence of direct involvement by Shorten, who was head of the state branch that negotiated the agreement.

The union agreed not to seek better pay for cleaners for three years in return for Cleanevent paying the union AU$25,000 a year. Cleanevent managers estimated the deal saved them up to AU$2 million.

"For workers employed by Cleanevent, the outcome was appalling," Heydon wrote. "All involved benefited from the deal except the people the union was supposed to be representing."