LONDON — The race to be Britain's next prime minister was whittled to two Thursday, with Conservative Party lawmakers assuring that the country will have a female head of government — the nation's first since Margaret Thatcher stepped down more than a quarter century ago.

The contest will pit the home affairs secretary, Theresa May, against Energy Minister Andrea Leadsom in a race that features contenders who were on opposite sides of last month's European Union referendum.

In a vote among 330 Tory members of Parliament, May led with 199 votes compared to 84 for Leadsom.

A third candidate, Justice Secretary Michael Gove, was knocked out after securing just 46 votes.

Gove had upended British politics last week by jumping into the race for prime minister at the last possible moment. The move forced the favorite, former London Mayor Boris Johnson, from the contest even before he had entered.

But Gove's unexpected betrayal also angered many Conservative lawmakers and prompted them to search for an alternative candidate to stand against the new front-runner, May.

That turned out to be Leadsom, a relative unknown in British politics who became a junior minister last year but has never served in the cabinet — normally a prerequisite for holding the nation's top job.

Leadsom begins the contest as a decided underdog against the better-known May, who dominated both Thursday's vote and an earlier round of balloting Tuesday.

But May will need to convince the party's rank and file, who will take the summer to choose a winner.

She wasted no time. In an apparent swipe at Leadsom moments after the vote, May said, “We need proven leadership to negotiate the best deal for leaving the European Union, to unite our party and our country.”

Whoever emerges will become prime minister Sept. 9, taking over for David Cameron. He announced his plans to step down last month, a day after failing to persuade the country to back the “remain” campaign in a referendum on Britain's EU membership.

Either Leadsom or May will be Britain's first female prime minister since Thatcher, who led the country from 1979 to 1990, and the second in British history.

With Hillary Clinton topping presidential polls in the United States and Chancellor Angela Merkel governing Germany, three of the West's leading powers could all be governed by female politicians by January in a historic first.

In Scotland, a woman — First Minister Nicola Sturgeon — could become a chief antagonist for the new British prime minister. Scotland favored remaining in the European Union, and Sturgeon could lead Scottish efforts to seek another independence bid from the U.K. in order to stay in the EU fold.

Both prime minister candidates have vowed to follow through with a British exit from the European Union by triggering Article 50 of the Lisbon Treaty, the never-before-used mechanism by which countries can leave the 28-member bloc.

But they disagree over how quickly to move. May has suggested it will not happen this year. Leadsom has said she will act as fast as possible.

Leadsom and May were on opposite sides of the EU debate. Leadsom, a former bank executive, emerged from relative obscurity by taking a leading role in the “leave” campaign.

May officially backed “remain,” but in practice she sat on the sidelines.

She has long held strongly Euroskeptic views and has said there will be no rerun of the referendum if she becomes prime minister.

“Brexit means Brexit,” she said last week when she announced her candidacy.