A young Danish Palestinian rapper and poet, whose debut collection criticising the Danish Muslim immigrant community provoked death threats and a physical assault, appeared in court this week to see his attacker sentenced to five months in prison.

But 18-year-old Yahya Hassan still faces a charge of racism in a second case brought in the same week by a local politician, who claimed that non-Muslims who spoke and wrote as he did would be open to prosecution.

Hassan burst onto the scene with an interview in Politiken newspaper in October entitled "I F***ing Hate My Parents' Generation".

His collection, titled Yahya Hassan, has sold 80,000 copies since October and is expected to have topped 100,000 by Christmas, according to publisher Gyldendal. He has won fans among the Danish middle-class for his work, which slams what he sees as hypocrisy among the immigrant Muslim community in Denmark, and accuses them of a raft of negative behaviours, including bad parenting and social security fraud.

His poetry has tapped into a rumbling public debate about Islam in Denmark, which erupted in 2005 when the daily newspaper Jyllands-Posten published a depiction of the prophet Muhammad with a bomb as his turban. The paper later apologised for publishing the cartoons, saying that they had caused "serious misunderstandings". The country has a strong pro-free speech lobby, which is open to hijacking by racists.

Hassan was brought up in the deprived area of Gellerup in Aarhus, with a disciplinarian father. He is vociferous in his criticism of his parents' generation of Muslims, and slams the attitudes of his peer group. He has been subject to death threats, and was assaulted in November at Copenhagen Central Station, by 24-year-old Isaac Meyer, also of Palestinian descent, who has previously served a jail term for his part in a failed terrorist plot.

The racism charge was brought this week by local politician Mohamed Suleban, who told Politiken newspaper: "He says that everybody in the ghettos like Vollsmose and Gellerup steal, don't pay taxes and cheat themselves to pensions. Those are highly generalising statements and they offend me and many other people."

Novelist Liz Jensen, who lives in Denmark, said: "Denmark is obsessed with him. He's a bright, angry young man, talented and very charismatic. He deserves attention because his poetry, born of rap, is raw and urgent and has huge flair. Its observational qualities, along with its mix of Danish street-slang and sophisticated word-play has real literary merit. But would he get so much coverage if he weren't criticizing the Muslim ghetto community he comes from? I suspect not."

She added: "Most of the people who come to his readings aren't his target audience. They are white middle-aged Danes. He's providing music for their ears. And many of those who laud him in the media aren't typical poetry-lovers: they're right-wing populists and those he calls "freedom-of-expression junkies". He is providing music for their ears, too. In the midst of all these he has really kept his integrity. He's the kid from the ghetto, giving the world the finger."

Hassan'a collection, written entirely in capital letters, is not yet available in English, but a translated excerpt from LONG POEM, published by the Wall Street Journal, provides a flavour of his work:

"You don't want pork meat,

may Allah praise you for your eating habits,

you want Friday prayer till the next Friday prayer,

you want Ramadan till the next Ramadan,

and between the Friday prayers and the Ramadans,

you want to carry a knife in your pocket,

you want to go and ask people if they have a problem,

although the only problem is you."