Boris Johnson's government is trying to boost its negotiating hand with Brussels

Britain's Boris Johnson lost his first test as prime minister on Friday after his candidate was edged out by a pro-EU rival in a by-election that slims his parliamentary majority to one.

Thursday's vote in the Welsh sheep farming community of Brecon and Radnorshire offered a stark choice between a Brexit-backing candidate from Johnson's Conservative party and a Liberal Democrat who wants to preserve Britain's four-decade stay in the EU.

Johnson dropped by the region on Tuesday to help out Chris Davies -- a Conservative MP who was forced to step down after becoming embroiled in an expanses scandal.

Davies protested his innocense and contested the seat again but the Liberal Democrats' Jane Dodds received 13,826 votes to Davies' 12,401 after having two smaller pro-EU parties back her bid.

The result extends a recent revival for the Liberal Democrats at the major parties' expense.

Its firm stand against Britain's split from the European Union saw it come a surprise second behind populist eurosceptic Nigel Farage's Brexit Party in the European Parliament elections in May.

Farage's candidate ate into the Conservative's support by picking up 3,331 votes. The main opposition Labour Party -- once a dominant force in Wales -- came in a distant fourth with just 1,680.

"My very first act as MP when I arrive in Westminster will be to find Boris Johnson wherever he is hiding and tell him loud and clear -- stop playing with the futures of our communities and rule out no-deal Brexit," a visibly relieved Dodds said.

Test of strength

The election was viewed as a test of strength for the "Boris bounce" that has helped the Conservatives regain a slim lead in some national opinion polls.

Control of Brecon and Radnorshire has swung between the Liberal Democrats and the Conservatives since the 1990s. It voted 52 percent to leave the European Union in the 2016 vote -- mirroring the UK-wide result.

But the controversies surrounding Davies turned this into an unusual contest whose outcome might not reflect either Johnson's or Brexit's true level of wider support.

The defeat still leaves Johnson in danger of being unable to control parliament in the crucial runup to Britain's scheduled departure from the EU on October 31.

MPs are already plotting ways to thwart his threat to take Britain out by the twice-delayed deadline without a divorce deal.

Johnson also needs to be able to pass legislation to make the potentially chaotic "no-deal" outcome as smooth as possible -- and to pass any compromise he might suddenly strike with Brussels.

The 650-seat chamber is fractured and includes MPs who at times switch sides or abstain at pivotal moments.

This leaves Johnson dependent on the whims of just a few legislators at one of the most crucial points in British history since World War II.

Fears of a no-deal divorce have already pushed the pound to its lowest levels since Britons first voted to leave in June 2016.

The Bank of England warned Thursday that a messy split would drop the pound even further and slow growth this year and next to 1.3 percent from around 1.5 percent.

Brexit PR blitz

The pound's slump reflects broader business jitters both in Britain and its main trading partners in Europe.

Johnson's government is trying to boost its negotiating hand with Brussels by showing that the country is ready for any outcome.

Finance minister Sajid Javid announced Wednesday an extra £2.1 billion ($2.6 billion, 2.3 billion euros) to prepare for leaving without an agreement.

Politico reported that part of the money would be spent on a Europe-wide media blitz that included adverts in major continental newspapers aimed at convincing EU governments about the strength of Britain's no-deal resolve.

Some analysts questioned how much of the funding was new and whether it would actually be used in the 90 days remaining before Brexit.

"We have to be prepared because we will be leaving on October 31," Javid said on Thursday.

The main opposition Labour Party's finance spokesman John McDonnell branded the funding an "appalling waste of taxpayers' cash".

The Labour MP who heads parliament's spending watchdog also pledged to investigate how the money was being spent.