CANBERRA, Australia — National lawmakers on Friday elected Treasurer Scott Morrison as the next prime minister in a ballot that continues an era of extraordinary political instability.

Morrison defeated key challenger Peter Dutton, a former cabinet minister, by a vote 45-40.

Dutton’s supporters had forced incumbent Prime Minister Malcolm Turnbull to hold the leadership ballot. Turnbull did not contest the ballot and has said he will quit politics.

Dutton’s failure prevents the Australian government shifting to the hard right.

Foreign Minister Julie Bishop had been among the favorites and could have become Australia’s second female prime minister. She was rejected on the first round of voting.

A beleaguered Turnbull demanded the names of lawmakers in the conservative Liberal Party who wanted him to go before he would allow them to choose a new prime minister at a meeting at Parliament House on Friday. The names would prove a majority of his government had abandoned him.

The bare minimum majority of 43 signatures were provided shortly before the meeting started. They included more than one Turnbull supporter who signed to break the impasse.

Turnbull has become the fourth prime minister to be dumped by his or her own party before serving a full three-year term since the revolving door to the prime minister’s office started in 2010.

The trend is universally hated by Australians.

Dutton’s and Turnbull’s camps waged the most chaotic, frenetic and at times farcical leadership struggle that Australian politics has seen in years, closing down Parliament on Thursday and damaging the Liberal Party’s credibility.

Public anger became apparent overnight with windows broken at the Brisbane office of Dutton, Turnbull’s main rival in his government.

But the extent of disquiet about Turnbull’s leadership proved to be exaggerated by many Dutton supporters. Of the 85 lawmakers at Friday’s meeting, 40 opted for no change.