LONDON — A new battle for Britain erupted Sunday, with London Mayor Boris Johnson saying he would join the campaign to encourage Britain to leave the European Union. The move posed a direct challenge to Prime Minister David Cameron, who has launched a major push to keep his country within the 28-nation bloc.

The popular, raffish Johnson immediately becomes the most prominent Conservative Party politician to break ranks with fellow Conservative Cameron’s vision of the best course for Britain in a June 23 referendum on EU membership.

The referendum has divided Cameron’s Conservative Party.

The decision of Johnson, a two-term mayor who has been touted as a possible future prime minister, deals a blow to Cameron’s hopes of a united front ahead of what is expected to be a hard-fought referendum.

So far, no country has ever left the EU, and several European countries outside the bloc are still working to reform their economies and governance systems so they can join.