In the Conservatives' first electoral test since Johnson became prime minister last month on a vow to complete Brexit "do or die," the party was defeated for the seat of Brecon and Radnorshire in Wales by Jane Dodds of the Liberal Democrats. Dodds won 43% of the vote, against 39% for Conservative Chris Davies, who fought to retain the seat after being convicted and fined for expenses fraud.
Dodds urged the prime minister to rule out leaving the EU without a divorce agreement, saying "a no-deal Brexit would be a disaster" for agricultural areas like her constituency some 175 miles (280 kilometers) west of London.
Sheep farmers in Wales worry that, without a Brexit deal, steep tariffs on lamb exports will devastate their business.
Johnson won a Conservative Party leadership race by vowing that Britain will leave the European Union on Oct. 31, with or without a divorce deal. But he faces opposition from Parliament, and the by-election result makes it even harder for the government to pass laws and win votes in the 90 days before the Brexit deadline.
The outcome also reflects the seismic effect the U.K.'s decision three years ago to leave the 28-nation EU has had on the country's politics, with voters increasingly split into pro-Brexit and pro-EU camps.
Labour won just 5% of the votes in Brecon. The Liberal Democrats made a pact with two other pro-EU parties, which did not run to give Dodds a better chance.
The Conservatives, meanwhile, lost support to the Brexit Party led by longtime euroskeptic figurehead Nigel Farage, which took 10% of the votes.
The Conservatives lack an overall majority in the House of Commons, and rely on an alliance with 10 lawmakers from Northern Ireland's Democratic Unionist Party. The loss of the Brecon seat leaves the governing alliance with 320 of the 639 voting lawmakers — the bare minimum needed to carry votes.
The loss illustrates the risks of Johnson's hard-line stance on Brexit. It comes after a week that saw the new prime minister booed by pro-independence protesters in Scotland, criticized by Welsh farmers and accused by Northern Ireland politicians of destabilizing the economy and the peace process with his willingness to opt for a no-deal exit.
Johnson insists that he wants a Brexit deal, but is demanding that the EU make major changes to the divorce agreement it struck with his predecessor Theresa May, which was rejected three times by Britain's Parliament. The EU is adamant that it won't renegotiate.
Johnson argues that a no-deal Brexit will be "vanishingly inexpensive" if Britain prepares properly. This week the government set aside 2 billion pounds ($2.4 billion) for no-deal measures including more border officers and stockpiling essential medicines.
Economists say no amount of preparation can eliminate the shock if Britain crashes out the EU's single market without a transition period or framework of new trade rules.
A slide prepared for the government outlining worst-case scenarios in the day, week and month after a no-deal Brexit mentioned "potential consumer panic and food shortages" and "possible increased risk of serious organized crime including people smuggling and illegal migration."
The slide was published by Sky News, which said it was drawn up before May left office last month. The government said it would not comment on leaked documents.
Bank of England Governor Mark Carney said a no-deal Brexit would deliver an "instantaneous shock" to the economy in which the pound would fall, prices would rise, GDP would slow and many businesses could face ruin.
"There are some very big industries in this country where that which is highly profitable becomes not profitable, becomes uneconomic, and very difficult decisions will need to be taken," Carney told the BBC on Friday.
Meanwhile a volatile political situation has become even more unpredictable.
Parliament voted in the past against Britain leaving the EU without an agreement, and is likely to try again in the fall to thwart Johnson's plans.
Faced with obstructive lawmakers, Johnson could gamble on an early election in hope of winning more seats. The opposition could also call for a no-confidence vote that could topple the government and trigger an early general election.
The Liberal Democrats hope their staunch opposition to Brexit will let them shed their perennial third-party status. Jo Swinson, the 39-year-old Scottish lawmaker who was elected party leader last month, said the Brecon result sent a "really clear message that the country doesn't have to settle for Boris Johnson or (Labour leader) Jeremy Corbyn."
But political experts advise caution. The Liberal Democrats have surged before, notably in 2010 when the party ended up with 57 seats and formed a coalition government with the Conservatives.
A backlash followed after the government slashed public spending and tripled university tuition fees — overturning a key Liberal Democrat campaign pledge. Many Lib Dem voters felt betrayed. At the next election in 2015 they won just eight seats.
Rob Ford, professor of politics at the University of Manchester, said the Brecon result was "unambiguously good news for the Lib Dems," but Britain's political volatility made it impossible to say whether it would lead to a breakthrough for the party.
"This a very small straw in a very strong wind," he said.
Follow AP's full coverage of Brexit at: https://www.apnews.com/Brexit