Angela Merkel has pledged the European Union’s support for averting a hard border on the island of Ireland despite concern this could undermine the single market in the event of a no-deal Brexit.

The German chancellor expressed solidarity with the Irish government in a visit to Dublin on Thursday and urged the UK to present a viable plan to avert crashing out of the EU next week.

Asked if averting a border was compatible with protecting the single market, Merkel told a press conference: “Where there’s a will, there’s a way … we simply have to do this, we simply have to be successful.”

The chancellor was speaking after meeting the Irish taoiseach, Leo Varadkar, and a group of people from Northern Ireland and the border area who told of lives and livelihoods lost during the Troubles.

Merkel said the stories moved her. “I lived behind the Iron Curtain, so I know only too well what it means once borders vanish … what I have heard here will encourage me to explore ways and means to continue the peaceful co-existence.”

Speaking at a joint press conference with Varadkar, the chancellor said Germany and the EU would consider an extension request to help the UK avoid a no-deal departure.

“We need to be patient and understanding of the predicament that they are in. But of course, any further extension must require and must have a credible and realistic way forward.”

She said she hoped Theresa May would be able to table a proposal by next Wednesday at a special European Council meeting. “We want to stand together as 27. Until the very last hour – I can say this from the German side – we will do everything in order to prevent a no-deal Brexit.”

Asked what will happen next week if the UK does not ratify May’s Brexit deal, the chancellor said she could not answer speculative questions and that the EU must respect the debate in Westminster.

Her visit came amid continued flux in Westminster where the House of Lords debated a bill to prevent a no-deal Brexit. It will remain with the Lords until Monday after squeaking through the House of Commons by one vote on Wednesday night.

Despite the public expression of solidarity from the EU’s powerhouse, Ireland is coming under mounting pressure from EU members to show how it will avoid a hard border while protecting the integrity of the single market.

With Merkel looking on, Varadkar vowed that Ireland would not become a “back door” for third-country goods into the EU but ducked a question about where Ireland would impose checks if not on the border.

“In event of a no-deal, it’s not possible quite frankly to have a clear plan because there are so many different possibilities and hypotheticals,” he said. That left open the prospect of checks in the Irish Sea.

Merkel’s visit – her first to Ireland since 2014 – came amid increasingly dire warnings of the consequences of a no-deal departure, with EU officials saying controls will have to be in place on day one for milk and other animal products coming from Northern Ireland, raising the spectre of a “milk lake”.

Irish authorities are becoming increasingly alarmed that tens of thousands of businesses that trade with the UK via ports in Dublin and Rosslare are not ready for a no-deal departure. “If these are perishable goods they run the risk of losing that load because they will be turned away,” Lynda Slattery, the head of the revenue service’s Brexit unit, told RTE.