A prominent critic of Boris Johnson has quit as a Government minister ahead of the result of the Tory leadership race, warning that Brexit has cast a "dark cloud" over the country.

Mr Johnson is widely expected to defeat Foreign Secretary Jeremy Hunt to become the Tory leader when the result of the contest is announced on Tuesday.

In a further sign of the difficulties he will face in uniting a bitterly divided Tory party, Sir Alan Duncan – an outspoken opponent of Mr Johnson – has quit as a Foreign Office minister before the incoming Prime Minister takes office.

READ MORE: Boris Johnson insists UK can leave EU with deal at end of October

His resignation will not be the last, with Chancellor Philip Hammond and Justice Secretary David Gauke having already confirmed they will quit rather than be sacked by Mr Johnson.

Sir Alan has been one of Mr Johnson’s fiercest critics on the Tory benches.

In June he described Mr Johnson as a “circus act” and last year he promised to end the former foreign secretary’s political career over his comparison of Theresa May’s Brexit deal to a “suicide vest”.

In his resignation letter to Theresa May, Sir Alan said he had "served with two very different Foreign Secretaries"; Mr Johnson and Mr Hunt.

"The UK does so much good in the world. It is tragic that just when we could have been the dominant intellectual and political force throughout Europe, and beyond, we have had to spend every day working beneath the dark cloud of Brexit," said the Midlands MP.

His resignation came after Mr Johnson restated his firm intention to get the UK out of the European Union by the end of October, claiming a deal with Brussels could be reached if the country has the “will” and the “drive” for Brexit.

The former foreign secretary said if it was possible to get to the moon and back 50 years ago then the problem of frictionless trade on the Irish border could be solved.

On the eve of the leadership ballot closing, Mr Johnson – who is widely expected to become prime minister on Wednesday – said it was time the country rediscovered its “sense of mission”.

READ MORE: Boris Johnson to launch Scottish 'charm offensive' with quick visit to Scotland to bolster Union

He wrote in the Daily Telegraph: “If they could use hand-knitted computer code to make a frictionless re-entry to Earth’s atmosphere in 1969, we can solve the problem of frictionless trade at the Northern Irish border.

“There is no task so simple that government cannot over-complicate if it doesn’t want to do it. And there are few tasks so complex that humanity cannot solve if we have a real sense of mission to pull them off.

“It is time this country recovered some of its can-do spirit. We can come out of the EU on October 31, and yes, we certainly have the technology to do so. What we need now is the will and the drive.”

POLITICS Tories(PA Graphics)

Mr Johnson claimed there were “technological pessimists” who think such a solution is impossible.

But he said: “There is abundant scope to find the solutions necessary – and they can and will be found, in the context of the Free Trade Agreement that we will negotiate with the EU (and this is common to both candidates in the current leadership contest) after we have left on October 31.”

In her reply to Sir Alan, the PM thanked him for his "devoted and energetic service".

She said: "You leave behind a record of which you can be very proud - a testament both to your own hard work and that of the dedicated public servants who work for the Foreign and Commonwealth Office at home and overseas.

"By standing up not just for British interests but for the enduring values which make our country what it is, they are working to make the world a safer, fairer, and more prosperous place.

"As we deliver the result of the EU referendum, they are helping to ensure that the United Kingdom emerges stronger, fairer, more united, and more outward-looking than ever before - a truly Global Britain which is the best friend and neighbour to our European partners, but which reaches beyond the borders of Europe and goes out into the world to build relationships with old friends and new allies alike."

The ballot of Conservative Party members will close at 5pm today with the result due to be announced on Tuesday morning at around 1130.

Mrs May will tender her resignation to the Queen after taking Prime Minister’s Questions in the Commons on Wednesday afternoon with the new Tory leader set to enter No 10 soon after.