LONDON — Three months ago, Rory Stewart was the darling of the pro-compromise wing of the Conservative Party, or at least what was left of it, traveling Britain on a quixotic mission to take over the party and end its enchantment with a cliff-edge split from Europe.

On Friday, having already been cut adrift from a party now in the grip of hard-line Brexiteers, Mr. Stewart quit the Conservatives altogether and threw his hat in the ring for a radically different job: mayor of London.

In an era of cacophonous disputes over Brexit, Mr. Stewart’s run will test whether there is still a constituency for mediating between Britain’s angry factions and cushioning its departure from the European Union with a deal — especially in London, a bastion of anti-Brexit activism.

With his lanky frame and earnest manner, Mr. Stewart cut a remarkably different figure from the eventual winner of the Conservative leadership race, Boris Johnson, who is vowing to pull Britain out of the European Union, with or without a deal managing future relations, on Oct. 31.