Poland’s prime minister has signalled his country will back the UK on a bespoke Brexit deal, at a meeting with Theresa May in Warsaw in which he warned against “very dangerous” EU protectionism.

Five senior cabinet ministers accompanied May on her visit to Warsaw, proof of the growing strategic importance of the relationship but which risked being overshadowed by the deepening rift between Mateusz Morawiecki’s administration and the EU over his government’s crackdown on judicial independence.

The UK chancellor, Philip Hammond, the home secretary, Amber Rudd, the foreign secretary, Boris Johnson, the defence secretary, Gavin Williamson, and the business secretary, Greg Clark, all flew in for the trip aimed at wooing the Polish government, seen as key allies in post-Brexit trade talks given their desire to retain close security cooperation.

At a press conference at which Williamson and his Polish counterpart signed a wide-ranging defence treaty, Morawiecki said there were clear joint interests in a bespoke deal.

“On economic cooperation, it is hard to find closer partners than we are,” he said. “The UK is a very important trade partner for Poland. The UK is a very powerful country exporting services. It’s obvious for the UK they would like to remain a very strong player in this area.”

Morawiecki said the EU should resist reactionary protectionism, something he said the UK had always pushed for as a member. “All the protectionist movements are very dangerous and that’s why we really regret losing the UK as our ally in a number of discussions at the EU level where we tried to mitigate and reduce the red tape and a number of regulations,” he said.

“But we do believe in this new agreement that will soon be worked out, will soon be negotiated, and we will be able to cooperate with the UK as close as possible.”

He said May had told him she wanted to maintain deep links on defence, economic affairs, student exchanges and educational cooperation.

Poland’s own influence at the European commission is highly contested, however, as it remains mired in a standoff after the commission said it would commence official censure proceedings over legal changes that the EU claims threaten the independence of the Polish judiciary. The government has in turn accused the commission of a politically motivated attack.