London, England (CNN) -- Gordon Brown went on the offensive against the two men hoping to replace him as prime minister at a debate Thursday, but it seems to have done him little good.
The foreign policy-themed contest -- the second of three ahead of the UK's May 6 general election --failed to produce a clear winner as Brown clashed with David Cameron of the Conservative Party and Liberal Democrat Nick Clegg over questions on defense policy, Europe, immigration and distrust of politicians.
But Cameron topped a snap poll by YouGov for the Sun newspaper, while Liberal Democrat Nick Clegg came first in a survey by ComRes for ITV News and the Independent newspaper.
Brown unleashed particularly sharp words at Clegg, who had shot up in the polls after being widely judged the best performer in last week's opening debate.
"Nick, get real, get real," Brown said when the politicians were questioned about defense policy.
And Brown attacked both Clegg and Cameron in a broadside intended to suggest that he offers a safe pair of hands after 13 years of Labour government.
"David, you're a risk to the economy. Nick's a risk to our security," he said.
In the YouGov poll, just over a third of debate viewers picked Cameron as the winner, while just under a third saw Clegg as the victor. Brown trailed in third place.
The ComRes poll put Clegg narrowly on top, with 33 percent. Cameron and Brown tied at 30 percent each in the poll. Clegg topped last week's ComRes poll by a much wider margin.
Ladbroke's, a betting shop, also declared Cameron the winner, saying betting shifted heavily to him during a question on immigration at the end of the debate.
Cameron struck an optimistic note in his closing statement, saying the British "need to make a clean break from the last 13 years (of Labour government), to have new leadership to take the country forward to solve the problems that we have, and I think the Conservatives are best placed to offer that ... rather than being stuck with what we have now.
"I still think we have incredible days ahead of us. ... We can achieve anything if we all pull together," Cameron said.
Cameron's Conservatives have led in the polls for several years, but last week's debate -- the first ever during a British election campaign -- shook up the race.
Clegg was widely judged the winner of the first debate, and polls showed the Liberal Democrats shooting from a distant third to first place in many polls.
Brown's Labour Party dropped to third place. But the tightening race has increased the likelihood of a "hung parliament," in which no party achieves an overall majority.
The Liberal Democrats are riding high on voter anger against politicians after a scandal over lawmakers' expense claims, campaigning as agents of change.
Clegg closed with a call for hope and change which echoed U.S. President Barack Obama's election 2008 campaign.
Voters are "beginning to hope that we can do something different," Clegg said. "Don't let anyone tell you that this time it can't be different. This time it can."
The refrain in last week's debate was "I agree with Nick," as Cameron and Brown appeared to try to cozy up to the man who could be kingmaker if neither of the main parties gets a majority.
But there was little affection for Clegg on display Thursday.
Cameron, in fact, twice said he agreed with Brown on defense, making a joke of it the second time.
But when the debate turned to benefits for the elderly, Cameron seemed visibly angry at Brown, accusing him of "lying" about Conservative policies.
"Every day Labour is putting leaflets through the doors and they're lies and it makes me angry. Will you withdraw the leaflets? You should be ashamed," Cameron demanded, referring to what he said were Labour party advertisements about Conservative plans to cut benefits for older people.
Brown replied that he had "not authorized" the leaflets.
The debate was officially about foreign policy, but the politicians took only four questions in the part of the debate dedicated to the subject: on Europe, Afghanistan, the environment and the visit of Pope Benedict XVI to the UK in September.
They later took questions on immigration, distrust of politicians and other subjects.
Voters cast their ballots on May 6 for lawmakers in 650 districts, or constituencies across England, Scotland, Wales and Northern Ireland. The party with the most lawmakers traditionally gets the first chance to form a government.
It's rare for no party to get a majority, but polls suggest it may happen this year. The last time it happened, in 1974, a new election was called within months.