Open this photo in gallery Liberal Democrat candidate Jane Dodd (C) celebrates with Liberal Democrat MP Ed Davey (2ndL) and her team after winning the Brecon and Radnorshire by-election at the Royal Welsh Showground in Builth Wells, Wales. Britain's Boris Johnson lost his first major test as prime minister on August 2 when his candidate lost to a pro-EU rival in a by-election that could narrow his parliamentary majority to one. Official results showed the European-supporting Liberal Democrats' candidate Jane Dodd defeating Chris Davies from Johnson's ruling Conservative party by 13,826 to 12,401 votes. ISABEL INFANTES/AFP/Getty Images

Britain’s pro-European Union Liberal Democrats have won a parliamentary seat from the governing Conservatives, a blow to Prime Minister Boris Johnson in his first electoral test since taking office.

The loss reduces Johnson’s working majority in parliament to just one ahead of an expected showdown with lawmakers in the autumn over his plan to take Britain out of the European Union on Oct. 31 without an exit agreement if necessary.

Johnson’s government already relies on the support of a small Northern Irish party for its wafer-thin majority, with just a handful of rebels in his own Conservatives needed to lose key votes.

Story continues below advertisement

The Liberal Democrats won the Welsh seat of Brecon and Radnorshire with a majority of 1,425 votes.

“Boris Johnson’s shrinking majority makes it clear that he has no mandate to crash us out of the EU,” Liberal Democrat leader Jo Swinson, whose party now have 13 seats in parliament, said in a statement following the result early on Friday.

“I will do whatever it takes to stop Brexit and offer an alternative, positive vision … We now have one more MP (Member of Parliament) who will vote against Brexit in parliament.”

Wales, and the Brecon area, voted to leave the EU at the 2016 Brexit referendum, but it is also a region where sheep outnumber people and where the prospect of steep EU tariffs being slapped on Welsh lamb exports in a no-deal Brexit have prompted widespread concern among farmers.

The Brecon vote was triggered when Conservative lawmaker Chris Davies was ousted by a petition of constituents after being convicted of falsifying expenses. Liberal Democrat candidate Jane Dodds won with 13,826 votes.

Davies, who ran again for the Conservatives, came second with 12,401 votes. The Brexit Party came third with 3,331 votes, while the main opposition Labour Party was fourth on 1,680 votes.

The Liberal Democrats had previously held the seat from 1997 until 2015, when it was won by Davies. In the 2017 snap election he held the seat with a majority of just over 8,000 votes.

Story continues below advertisement

Johnson, who took office last week, has said he does not plan to hold an election before Britain leaves the EU but could be forced to if lawmakers try to stop him pursuing a no-deal exit by collapsing the government in a no-confidence vote.

The result in Brecon, where the combined vote for pro-leave parties outnumbered pro-remain, would likely add to calls for a possible Conservative-Brexit Party alliance in any upcoming election.

Pro-EU parties, including the Greens and Plaid Cymru, agreed not to stand in the Brecon election on Thursday to boost the Liberal Democrats chances by concentrating the support of ’Remain’ voters behind one candidate.

The Brexit Party, led by prominent Brexit campaigner Nigel Farage, was only launched in April and rode a wave of anger over the government’s failure to deliver Brexit to sweep to victory in the United Kingdom’s European Parliament election in May.

“If the Brexit Party do hang around and the Conservative Party doesn’t deal with them effectively, ie. if we don’t show signs that we are leaving Europe by the end of October, then that could really have some repercussions for our vote not just in seats like this but across the U.K.,” Nick Ramsay, a Conservative member of the Welsh Assembly told Sky News.