ISTANBUL/BRUSSELS - The threat of a hard British exit from the European Union looms large over a country that has a big stake in the process but no official say: Turkey.

Already mired in recession, Turkey stands to lose access to its second-largest export market for years to come if Brexit goes wrong, with its autos, textiles and appliances facing the biggest risk.

Britain and the EU agreed last week to delay Brexit until Oct. 31. But if Britain ultimately leaves without trade arrangements - a so-called "hard" or no-deal Brexit - most of Turkey's $3.7 billion trade surplus with the UK would be wiped out, according to a United Nations report.

Among non-EU countries, Turkey would feel the most pain with $2.4 billion in lost exports a year, followed by South Korea and Pakistan, the report said.

Exports are considered vital to Turkey's recovery from recession after last year's lira crisis knocked some 30 percent off the value of the currency. If Britain leaves the bloc without a replacement trade deal, Turkey, covered by the EU's customs union, would lose open access to the UK market.

Turkey and Britain would then need to impose customs duties that could only be reversed by a replacement deal, leaving a lasting mark on bilateral trade, which reached $18.6 billion last year.

"If we have a no-deal Brexit, Turkey and the UK can only seal their trade deal after the EU and the UK have done theirs. And that would take years," Kati Piri, the European Parliament's point person for ties with Turkey, told Reuters.

The EU and British legislators have toiled to avoid the most-damaging, abrupt split. But the latest postponement of Brexit essentially means all options - including the hard exit - are still open.

In 2017, Ankara and London formed a working group on trade deals and, according to industry officials, talks continued this year. Nearly a year ago, both countries expressed optimism that a free trade deal will be reached, though it was unclear how it would address a hard Brexit.

Turkey has been covered by the EU's customs union for more than 20 years, providing duty- and barrier-free access to each others' markets.

But Turkey has pushed to update the agreement, given its "asymmetrical" structure, which does not grant Turkey a seat at the table when the EU negotiates with outside countries.

EU diplomats have acknowledged it is "outdated," including around dispute-resolution mechanisms. But talks have been frozen since Turkish President Tayyip Erdogan's sweeping crackdown on critics after an attempted 2016 coup.

Piri said there was an opportunity to revive modernisation talks after European Parliament elections in May. But even so, under a hard Brexit, any Turkish-British free-trade deal to restore the status quo would only be possible after London struck a new deal with Brussels.

"There might be tariffs and customs walls. Both sides need to make a contingency plan to overcome this issue," said Cigdem Nas, secretary general of the Economic Development Foundation, a Turkish think tank.

She said stop-gap measures are being put in place. "Some scenarios are uttered where companies rent warehouses to fill over there (in Britain) in order to maintain a supply chain, but it does not look like a permanent solution," Nas said.

"It will be very hard to replace the current trade chain if there is no-deal Brexit."

'ALL BETS ARE OFF'

Turkey has consistently logged a valuable trade surplus exporting to Britain.

Duties and other disruptions would hit Turkey's auto industry the most, followed by textiles and home electronics industries. The three made up half of Turkey's $11.1 billion exports to the UK last year.

Turkey's annual UK garment exports total some $2 billion. Mustafa Gultepe, head of Turkey's largest garment-exporters union, told Reuters in January a hard Brexit would cut exports as much as 20 percent and some 12 percent in duties.

Turkey's auto industry exports about 170,000 vehicles to the UK per year, "thus customs duties is a risk to exports" said Osman Sever, secretary general for the country's Automotive Manufacturers Association.

Another strain would be longer delays at borders as both countries look to change customs-processing procedures, Sever said, adding that his association advised Turkey's trade ministry on Brexit effects.

A pan-Europe supply chain has been established over several years, including for Ford, which produces engines in British plants that are then shipped to its Turkish factories to be fitted into vans.

"All bets are off in case of a hard Brexit. Trade may even come to a full stop. We'll try to keep it down, but import and production costs increase under almost all scenarios," said one local Turkish vehicle producer who did not want to be named.

(Reporting by Can Sezer in Istanbul and Gabriela Baczynska in Brussels; additional reporting by Ezgi Erkoyun; editing by Jonathan Spicer and Larry King) ((can.sezer@tr.com; +90-212-350 7055; Reuters Messaging: can.sezer.thomsonreuters.com@reuters.net))