Theresa May has made a thinly veiled attack on Boris Johnson’s “do or die” approach to leaving the EU on 31 October, insisting that the right approach for Britain was to leave with a deal.

Attending her last EU summit in Brussels as prime minister on Sunday, May took aim at the approach of the Tory leadership frontrunner, who has taken an increasingly hardline approach in recent days.

Johnson has said that if the EU declines to renegotiate the withdrawal agreement and remove the contentious Irish backstop, he would take the UK out of the EU without a deal on Halloween.

Excluded, isolated, humiliated: a history of May's visits to Brussels Read more

When asked if this was the best approach to Brexit, May suggested the next prime minister should focus on getting a deal through the Commons. The prime minister was thwarted three times by MPs in seeking to get the withdrawal agreement ratified.

She said: “I’ve always been very clear that I think the best approach for the UK is to first of all ensure we’re delivering on the vote that took place in 2016, leaving the EU, but that we do that with a good deal so we can do it in an orderly way.

“I still think we negotiated a good deal. I wasn’t able to get a majority in parliament for that deal. It will be up to my successor to get that majority, deliver on the vote and take us forward.”

The Irish prime minister, Leo Varadkar, said Johnson would receive a “fair hearing” should he win the keys to Downing Street next month. “But we also need to make sure that everyone in the UK understands what we mean when we say that withdrawal agreement with the backstop cannot be reopened,” Varadkar said.

May went on to say she was proud of what she had achieved, particularly on security threats including from Russia and on the climate crisis, on which she claimed the UK had taken a lead.

Anti-Brexit anglophile Frans Timmermans tipped for top EU post Read more

“Of course we have had some tough and long talks about Brexit,” she said. “We have also talked about how we will protect and maintain our shared prosperity and security.”

She said she was looking forward to a “constructive discussion” of who should take up the top jobs in the EU institutions, the sole focus of the summit, including a replacement for Jean-Claude Juncker as European commission president.

But May appeared to be in a potentially awkward position with Poland, Hungary, the Czech Republic and Slovakia looking likely to try to block the appointment of the frontrunner, Frans Timmermans, who as vice-president of the commission has been a strident critic of populist governments weakening independent judiciaries.

Should Italy back the so-called Visegrád group, the UK would be left in effect with a casting vote despite insisting it would not meddle in future EU affairs. The leaders have set themselves the goal of making a decision by Monday morning.