Boris Johnson insisted he was “full of optimism and buoyancy” as he awaited the results of two by-elections which could have significant implications for his leadership.

Polls have closed in Wakefield and Tiverton and Honiton after contests triggered by Conservative MPs resigning in disgrace.

With Labour challenging in the red wall seat in West Yorkshire and the Liberal Democrats hoping to overturn a huge Conservative majority in Devon, defeat for the Tories could raise further questions about Mr Johnson’s position, just weeks after 41% of his MPs said they did not have confidence in him.

The Prime Minister will be monitoring the results from Rwanda, where he is attending the Commonwealth leaders summit.

Speaking to broadcasters in the capital Kigali, the Prime Minister said: “I’m going to be watching the results with interest but always full of optimism and buoyancy but most seasoned political observers know that by-elections in mid-term are never necessarily easy for any government.”

He has suggested it would be “crazy”for him to quit if the party lost the two seats and claimed he was “very hopeful” about the results.

Despite the Prime Minister’s claims, a senior Tory source acknowledged the situation was looking “extremely difficult” in the Devon seat, while in Wakefield a Labour campaign source said Sir Keir Starmer’s party would “just” win.

In Wakefield, ex-Conservative MP Imran Ahmad Khan quit after being found guilty of sexually assaulting a 15-year-old boy – a crime for which he was jailed for 18 months.

Imran Ahmad KhanFormer Conservative Wakefield MP Imran Ahmad Khan was convicted of molesting a teenage boy (Dominic Lipinski/PA)

Wakefield was one of the so-called red wall seats won by the Tories in the 2019 general election after being a Labour stronghold since the 1930s, but Labour is now hoping to take it back.

In Devon’s Tiverton and Honiton, Neil Parish, the Tory MP since 2010, resigned after admitting he had watched pornography on his phone in the House of Commons.

The Liberal Democrats are the main challenger in this rural south-western constituency, where they are hoping to recreate by-election wins in North Shropshire in December and Chesham and Amersham a year ago.

Victory for the Lib Dems would require overturning a Conservative majority of 24,239, but party leader Sir Ed Davey was confident they were “neck and neck” with the Tories on the eve of the vote.

Neil Parish Tory Neil Parish resigned as Tiverton and Honiton MP after watching pornography in the Commons (Chris McAndrew/UK Parliament/PA)

Residents are “fed up of Boris Johnson’s lies and neglect,” he said, as he called on them to back his party’s candidate, former soldier Richard Foord.

“Farmers have been sold out by foreign trade deals, people are struggling to access GPs and dentists, and local roads and schools have been left to crumble.

“Families are facing soaring petrol bills and food prices and this government’s only answer is to hammer them with constant tax rises”.

The Prime Minister urged voters to “stick up for British food and farming” by supporting Tory Helen Hurford, a former head teacher.

In a video shared on social media on Wednesday, Mr Johnson appeared alongside the candidate on a farm, saying the party was working to protect “our fantastic food and farming industry and “amazing agricultural sector”.

Losing the Tory stronghold would be seen as a sign of Mr Johnson’s diminishing electoral appeal after partygate and amid the cost-of-living crisis, and could spark a further backlash against his authority.

The Tories face a steeper challenge in retaining the Wakefield seat, with Labour now odds-on favourites to overturn the 2019 Conservative majority of 3,358.

Tory candidate Nadeem Ahmed raised eyebrows by arguing last week that voters should still trust the party after Mr Khan’s sexual assault conviction, just as they still trust GPs despite the crimes of mass murderer Harold Shipman.

Labour leader Sir Keir Starmer has said a victory in the northern constituency “could be the birthplace of the next Labour government”.

Wakefield Labour leader Sir Keir Starmer told supporters in Wakefield that a victory there could herald the next Labour government (Dave Higgens/PA)

On the eve of polls opening, he said: “The public is fed up of Boris Johnson and a Conservative Party that promises big but never delivers.

“Labour’s candidate Simon Lightwood has run a positive campaign – with a plan to attract well-paid jobs and investment to Wakefield, put more police on the streets to tackle anti-social behaviour, and to fight for scrapping the unfair National Insurance rise.

“But a vote for anyone other than Labour will let Boris Johnson off the hook. The people of Wakefield have a chance to send a message to the Tories that enough is enough”.

If the Conservatives were to lose both by-elections, it would be only the seventh time a government has suffered such a double defeat since the Second World War.