LONDON — Britain’s right-wing U.K. Independence Party has chosen European Parliament member Diane James as its leader, replacing the charismatic but divisive Nigel Farage.

James defeated four other candidates in a ballot of party members.

Britain’s June 23 vote to leave the European Union was a triumph for UKIP, which had campaigned for years to leave the bloc. Under Farage the party moved from fringe player to a political force capable of winning millions of votes and swaying public opinion.

Farage announced his resignation after the referendum, and the party has since descended into feuding.

The leadership race has been acrimonious from the start. Steven Woolfe, a Farage ally and the favorite to win the contest, was excluded because he missed the application deadline by 17 minutes.