British Prime Minister Gordon Brown and his Conservative Party challenger, David Cameron, on Thursday opposed giving amnesty to illegal immigrants, saying that would send the wrong message to people looking to sneak into Britain.

A question on immigration turned into a flashpoint in the third and final televised debate among Mr. Brown, Mr. Cameron and Liberal Democratic candidate Nick Clegg in Birmingham.

Mr. Brown’s Labor Party slipped in the polls this week after the prime minister was caught on an open microphone describing a longtime party supporter as “bigoted” after she expressed concern about the influx of Eastern European immigrants.

In a bid to recover from the gaffe, Mr. Brown referred good-naturedly to the incident in his opening remarks. “There is a lot to this job, and as you saw yesterday – I don’t get all of it right,” he said. A former chancellor of the exchequer, he played up his economic credentials, adding, “But I do know how to run the economy in good times and in bad.”

On Wednesday, Mr. Brown had been critical of the Labor Party worker’s question on immigrants, but a day later, he said he was opposed to a proposal from Mr. Clegg’s party to provide amnesty to illegal immigrants.

“I can’t see how you send out anything but the worst possible message by giving amnesty to people who have come to this country illegally. … It encourages other people to come here illegally,” Mr. Brown said.

Mr. Cameron described immigration in Britain as “too high for too long.”

The Conservative leader proposed a cap on immigration, saying one of the benefits of stemming the flow would be allowing those already in the country to better integrate.

Describing the Liberal Democrats’ amnesty as a “complete mistake,” Mr. Cameron said, “We should be trying to reward people for doing the right thing.”

Mr. Clegg accused Mr. Cameron of mischaracterizing his amnesty plan. The proposal is to give amnesty to illegal immigrants who have been in the country for 10 years, provided they meet certain conditions.