Ed Miliband said he would rather not have a Labour government than do a deal with the Scottish National Party in a forceful rebuttal of suggestions he would enter Downing Street with the backing of Nicola Sturgeon.

Miliband said he could not enter a coalition or a confidence-and-supply agreement with the SNP to secure power in Westminster if he does not win a majority in the 7 May election because he will not compromise on issues such as the Trident nuclear deterrent and Scottish independence.

He was taking part in a special edition of BBC Question Time alongside the Conservative leader David Cameron and Liberal Democrat leader Nick Clegg. All three faced 30 minutes of questioning from an audience of voters.

"If Ed Miliband is saying that he would rather let the Tories back into government than work with the SNP to keep them out, people in Scotland and indeed elsewhere in the UK would never forgive the Labour Party," Stewart Hosie, deputy leader of the SNP, said in a statement after the programme.

"This makes it even more important that Scotland unites to elect a big team of SNP MPs, so that we are in a decisive position at Westminster and Scotland can never again be ignored. Labour already had huge problems in Scotland -- Ed Miliband has just made them a whole lot worse."

During Miliband's slot, he was branded a liar by an audience member as he faced down a challenging series of questions on whether voters were able to trust the Labour party with the economy after it left behind a gaping deficit in public finances in 2010.

The Labour leader pinned the blame for the deficit on the global financial crisis, which tore through economies and crushed tax receipts. Miliband also defended Labour's debt-fuelled spending in the years leading up to the crisis, saying it helped build much-needed schools and hospitals and that he did not accept the argument that his party overspent.

Cameron was also called a liar by the audience over his promise before the 2010 general election to get net migration to the UK down to the tens of thousands. It is currently almost 300,000 a year because of the European Union's (EU) policy of the free movement of labour, but Cameron reiterated his desire to get it below 100,000.

David Cameron Conservative
David Cameron brandishes the Liam Byrne note. Getty

When asked how he could control immigration while we stayed in the EU, Cameron said the only way to guarantee an in/out referendum on the EU was to vote Conservative. This effectively ruled out another coalition with the Liberal Democrats, which have said they will not join a government that plans to hold a referendum on the EU unless there is the threat of a transfer of power from Westminster to Brussels.

At one point during his 30 minutes, Cameron pulled out an embarrassing note from the former Labour minister Liam Byrne, left behind in 2010, apologising for there being no public money left.

Cameron was also criticised for the vagueness of where the £12bn cuts to the welfare budget being proposed by his party will fall. He did not give details, but said he would rather cut the welfare bill than public services such as the NHS.

Lib Dem leader Clegg got off to a difficult start when the first question raised his broken tuition fees pledge and asked how voters could ever trust what he was saying after that. Clegg said he had apologised and had made a mistake, but had delivered on other promises, such as cutting income tax for the lowest paid by raising the personal allowance.

Nick Clegg Lib Dem
Lib Dem leader Nick Clegg. Getty

Clegg also sought to reassert the Lib Dems as a party of the reasonable centre ground. The Conservatives would cut too deeply to public finances, he argued, while Labour would borrow and spend irresponsibly. The Lib Dems were offering fairer austerity, he said, with a bigger burden falling on the wealthiest.

He added that the real question at the general election was who the public wanted to enter Downing Street with either Cameron or Miliband, because neither would win a majority.

A snap poll by ICM/Guardian after the debate put Cameron out on top with 44% saying he did best on the night. Miliband was on 38% and Clegg on 19%.