Compromise plans to create a new offence of incitement to religious hatred while protecting free speech have been unveiled by ministers.
Muslim groups have led calls for new laws
The government's original plans for the new offence were heavily defeated in the House of Lords last year.
Critics said the proposed legislation was drawn too widely and could outlaw criticisms of beliefs.
Ministers have now published their revised plans, which have been welcomed by some opposition peers.
They have bowed to the critics' demand that incitement to religious hatred be covered by separate legislation rather than be joined to race hate laws.
Somebody could only be convicted of the new offence if they intended or were reckless about inciting hatred.
And there is a new clause in the legislation declaring that a person is not guilty of an offence if they debate issues, insult or ridicule a religion - unless they intend to stir up religious hatred.
The Home Office says the original plans would not have stopped comedians telling religious jokes but the new plans give an "absolute guarantee".
Home Office Minister Paul Goggins said the amendments would mean it would be an offence to incite hatred against Muslims, Hindus and Christians.
It is already an offence to stir up hatred against Sikhs and Jews through race hate laws.
Lib Dem peer Lord Lester, a leading critic of the original plans, said the new amendments had sprung from talks with the government.
"They are a great step forward for free speech," he said.