LONDON, July 7 (Reuters) - Scandal-ridden Boris Johnson announced on Thursday he would quit as British prime minister after he dramatically lost the support of his ministers and most Conservative lawmakers, but said he would stay on until his successor was chosen. Bowing to the inevitable as more than 50 ministers quit and lawmakers said he must go, an isolated and powerless Johnson said it was clear his party wanted someone else in charge. Today I have appointed a cabinet to serve, as I will, until a new leader is in place, Johnson said outside his Downing Street office where his speech was watched by close allies and his wife Carrie. I know that there will be many people who are relieved and perhaps quite a few who will also be disappointed. And I want you to know how sad I am to be giving up the best job in the world. But thems the breaks. Johnson gave no apology for the events leading to his announcement and said his forced departure was eccentric. There were cheers and applause as he began his speech, while boos rang out from some outside the gates of Downing Street. After days of battling for his job, Johnson had been deserted by all but a handful of his closest allies after the latest in a series of scandals broke their willingness to support him. The Conservatives will now have to elect a new leader, a process which could take weeks or months, with details to be announced next week. read more A snap YouGov poll found that defence minister Ben Wallace was the favourite among Conservative Party members to replace Johnson, followed by junior trade minister Penny Mordaunt and former finance minister Rishi Sunak. While Johnson said he would stay on, opponents and many in his own party said he should leave immediately and hand over to his deputy, Dominic Raab. Keir Starmer, leader of the main opposition Labour Party, said he would call a parliamentary confidence vote if the Conservatives did not remove Johnson at once. We cant go on with this prime minister clinging on for months and months to come, he said. The crisis comes as Britons are facing the tightest squeeze on their finances in decades, in the wake of the COVID-19 pandemic, with soaring inflation, and the economy forecast to be the weakest among major nations in 2023 apart from Russia. It also follows years of internal division sparked by the narrow 2016 vote to leave the European Union, and threats to the make-up of the United Kingdom itself with demands for another Scottish independence referendum, the second in a decade. Support for Johnson had evaporated during one of the most turbulent 24 hours in recent British political history, epitomised by finance minister, Nadhim Zahawi, who was only appointed to his post on Tuesday, calling on his boss to resign. Zahawi and other cabinet ministers went to Downing Street on Wednesday evening, along with a senior representative of those lawmakers not in government, to tell Johnson the game was up. Initially, Johnson refused to go and seemed set to dig in, sacking Michael Gove - a member of his top ministerial team who was one of the first to tell him he needed to resign - in a bid to reassert his authority. But by Thursday morning as a slew of resignations poured in, it became clear his position was untenable. You must do the right thing and go now, Zahawi tweeted. Some of those that remained in post, including Wallace, said they were only doing so because they had an obligation to keep the country safe. There had been so many ministerial resignations that the government had been facing paralysis. Despite his impending departure, Johnson began appointing ministers to vacant posts. It is our duty now to make sure the people of this country have a functioning government, Michael Ellis, a minister in the Cabinet Office department which oversees the running of government, told parliament.