LONDON - With Brexit still unsolved, the United kingdom (UK) is expected to have a general election by the end of the year, with Boris Johnson hoping to win a majority for the Conservative Party. But one of his vanquished rivals for the leadership race earlier this year is set to exit stage left.

Rory Stewart, who was in the running to become Britain's prime minister earlier this year, has resigned from the Conservative Party and announced he is quitting politics altogether.

Rory Stewart has quit the Conservative Party and will run as an independent candidate for London mayor.

The former Cabinet minister was among the 21 rebels who had the whip removed by Boris Johnson when they defied the Prime Minister by backing a move designed to block a no-deal Brexit.

Mr Stewart, a former army office and International Aid Secretary, was one of 21 rebel Tories who voted to introduce a new law, known as the Benn Act, designed to block Britain from leaving the European Union without a deal.

Mr Stewart, MP for a constituency in Cumbria since 2010, tweeted that it had been a "great privilege" to serve Penrith and The Border for a decade.

Prime Minister Boris Johnson has promised to deliver Brexit on 31 October with or without a deal, tearing the Tory Party apart.

Last month Mr Stewart was reportedly flirting with the Liberal Democrats and earlier this week he told the Cliveden Literary Festival he was thinking of setting up a new centrist party, based on Emmanuel Macron's En Marche.

Mr Stewart, 46, was likely to have been deselected by his local party in Penrith, where he had a majority of almost 16,000 at the last election.

Mr Stewart, who is reportedly a former MI6 operative, was on the left of the Conservative Party and when Theresa May stood down earlier this year he pledged to "bring the country together" on the diverse issue of Brexit.

​He said at the time: "It's important at this time when the Prime Minister's said she's going to step down to have a voice arguing for being radical — but radical in the centre of British politics, not radical on the extreme right of British politics. A voice that's prepared to say I do want to bring this country together. I accept Brexit, I'm a Brexiteer, but I want to reach out to Remain voters as well to bring this country together again. The only way I can do that is by moving beyond my brief and beginning to lay out, whether it's on climate change or any of these other issues, what I think it would mean to be a country we can be proud of."

Mr Stewart performed surprisingly well but was finally eliminated after the third round of voting and Mr Johnson went on to defeat Foreign Secretary Jeremy Hunt in the members' ballot.