Video footage of the chaos after Mr Vilks was attacked
A Swedish artist who created an international furore by depicting the Prophet Muhammad as a dog was assaulted as he delivered a university lecture.
Lars Vilks says he was head-butted by an audience member as he spoke about the limits of artistic freedom.
The cartoonist's glasses were broken, but he was not injured.
Mr Vilks has been threatened on numerous occasions, but the assault at Uppsala University was the first time he has been physically attacked.
The artist said a group of about 15 people had been shouting and trying to interrupt the lecture, which was attended by about 250 people.
"A man ran up and threw himself over me. I was head-butted and my glasses were broken," Mr Vilks was quoted as saying by the AP news agency.
A video clip of the attack was posted on the website of a Swedish newspaper.
It showed police using pepper spray and batons to control an angry crowd shouting "God is great" in Arabic as Mr Vilks was led away. Two people were detained.
Earlier this year, Mr Vilks was the target of an alleged murder plot involving Colleen LaRose, an American who called herself "Jihad Jane".
She has pleaded not guilty, but faces life in prison if convicted.
In 2007, a group linked to al-Qaeda in Iraq offered a $100,000 (£66,000) reward for killing Mr Vilks, and a 50% bonus if he was "slaughtered like a lamb" by having his throat cut.
The Vilks cartoon was published about a year-and-a-half after a series of depictions of the Prophet Muhammad in Denmark's Jyllands-Posten paper caused protests by Muslims around the world.