Wearing his trademark flat cap, Lars Aslan Rasmussen was full of optimism as he began canvassing in Nørrebro, a volatile Copenhagen enclave that epitomises the two dominant issues of the Danish election, immigration and welfare. But the mood swiftly changed.

Aslan Rasmussen was surrounded by a group of extreme Islamists as he distributed leaflets at the suburban train station, a labyrinth of dark passages, cracked windows, graffiti and very un-Danish litter. “They said I should leave their territory and that Muslims are not allowed to vote. They were very aggressive and told me that you don’t go to paradise when you participate in democracy.”

A Social Democrat with a Turkish father and Danish mother, Aslan Rasmussen is trying to step up from the city council, where he has a reputation as a role model for integration.

“It’s serious. I’m not the only one with this experience,” he said in a capital brimming with election posters for aspiring politicians with Muslim names. “The Islamic groups are very active, trying to stop people from voting. There are some areas where I’m afraid to go alone. The police need to be in this area to make sure that people are not afraid to vote.”

Nørrebro station is close to where Omar el-Hussein, the Valentine’s Day shooter, was killed by police in an exchange of fire less than 24 hours after the radicalised gangster launched a lone jihad against a country once called the happiest on Earth. It is surrounded by austere estates that terrorism experts regard as parallel societies, where Danish values are despised and extreme Muslims espouse sharia law.

As Aslan Rasmussen was being intimidated, Uzma Ahmed loaded her cargo bike’s goods compartment with election posters and slowly pedalled through Nørrebro. She stopped at the traffic lights on the edge of Nørrebro’s urban park. To the right lay the station. Ahmed, a 40-year-old former youth worker standing for the new Alternative party, turned left. “I was prepared [for the threats] and that is why I have allied myself with the shawarma-owners, stores and kiosks,” she said. “But I had a discussion with one of the shawarma-owners. He said: “Sister, I can’t vote for you. You know it is forbidden, haram. The brotherhood says so.’”

Ahmed, born of Pakistani parents in Odense, Denmark’s third-largest city, continued: “After the terror attacks, now the election is on, everyone fears we’re going to be stigmatised further.” Her route took her past the internet cafe where police arrested some of Hussein’s five alleged accomplices. They are now on remand, charged with helping to furnish him with weapons.

Ahmed’s Alternative party is hoping to secure 2% of the nationwide vote required for entry to Christiansborg, the Danish parliament, the former royal palace that acts as the setting for Borgen, the cult television drama about a female Danish prime minister.

She trundled past kebab joints, halal butchers and shops selling beaded wedding dresses and gaudy jewellery, squeezing by a couple of beggars seeking charity from shoppers in chadors and ankle-length black coats. The refusal of summer to materialise reinforced Nørrebro’s grittiness.

Ahmed asked the owner of an open-all-hours grocery store for permission to display her apple green portrait. “If you can find space, then you can have it,” he said. The shop was crammed with Middle Eastern pulses, oriental pickles and sauces, with not an inch of spare wall.

Ahmed turned over a milk crate and, struggling on tiptoe, taped the poster to the ceiling. “That should draw people’s attention,” she said, beaming.

Her homespun entry into national politics could not contrast more profoundly with the juggernauts of the three main parties, now running at full tilt after the Social Democrat prime minister, Helle Thorning-Schmidt, dissolved parliament, three months before her term expired.

Opinion polls, viewed with suspicion after the recent British experience, suggest that Denmark will reject Thorning-Schmidt and her red bloc. But the numbers are closing in Thorning-Schmidt’s favour; the blues currently lead by 51% to 49%.

If the margin remains the same on 18 June, the prime minister will probably be Lars Løkke Rasmussen, leader of the right-leaning Liberals, and he will underpinned by the anti-immigrant Danish People’s party.

Both the DPP and the Liberals are vying to be the second-biggest party, behind Thorning-Schmidt’s Social Democrats, currently polling 25%. Unusually, the DPP does not wish to enter a coalition. It intends to support the Liberals in parliament, using its muscle to force through issues it regards as critical.

Løkke Rasmussen is promising working Danes that he will allow them to keep more of their income. Denmark has some of the highest tax rates on the planet. In order to fund tax cuts, he would need to reduce the country’s generous welfare payments and foreign aid disbursements. The link between immigration and welfare was emphasised in studies by the Confederation of Danish Employers that are helping Løkke Rasmussen justify some of his policies. The first showed that three of every four refugees granted asylum between 2000 and 2003 were unemployed more than a decade on. The second, an analysis of 40,000 jobs created in the private sector since 2011, suggests that 75% were taken by foreigners, mostly from Poland, the Baltic states and Romania, as well as shop workers from Sweden prepared to accept the going rate of £10.50 an hour in a nation with no legislated minimum wage.

The Liberals interpret these figures as evidence that benefits need to be cut to encourage Danes to get off the dole. Currently an unemployed person aged 30 or more can claim a minimum of £1,377 a month from the state, as well as other packages such as housing assistance. Løkke Rasmussen is concerned that some families can accrue as much as £45,000 a year in welfare, and he advocates imposing a benefits ceiling.

Uzma Ahmed’s thousand-watt smile evaporates as she discusses what she sees as the portrayal of ethnic minorities as workshy social security scroungers: “The people I talk to want a nice future. They know to get that you need to have a job. They want a job.”

Ahmed blames nepotism and discrimination against Muslims as almost insurmountable obstacles. She says immigrants lack the connections that Danes use to advance their careers. “When you want a job and you don’t have a nice network, you can’t get it,” she said. “When talking about immigrants, Danish politicians don’t admit that what they’re really talking about is Muslims or brown people.” Ahmed is campaigning for what she calls “the new we” in a country where 10% of the 5.5 million population are from ethnic minorities.

Immigration loomed large in the first of the party leaders’ televised debates. But the probable kingmaker, Kristian Thulesen Dahl, leader of the Danish People’s party, benefited from remaining silent on his signature issue. Dahl, an accomplished debater, was judged to have won the contest after maintaining an inscrutable mask as Thorning-Schmidt was lacerated on immigration by Johanne Schmidt-Nielsen, the sparky head of the Red-Green Alliance.

“Helle, you’re standing here in competition with the blues about who can turn their back on most refugees,” said Schmidt-Nielsen.

“I’m not looking after Denmark and the Danes properly if I do not ensure that we can cope,” responded the premier. “We have to acknowledge that we cannot take in all the refugees who want to come to Europe.”

The clash highlighted the schisms that exist over immigration within the red bloc. Thorning-Schmidt proudly reiterated that her Social Democrat government introduced the first tightening of immigration laws in 12 years.

The tone of the early salvoes dismayed Noura Bittar Søborg, a Syrian asylum seeker who fled Homs in 2011 and has managed to bring her father, mother and younger sister to Denmark. She is still trying to secure safe passage for another sister. Søborg, 26, describes herself as a secular humanist from a Muslim background. “Immigrants have the smallest voice. We’re afraid they will take our children away, or send us back to war zones,” she said.

Now married to Allan, a builder, Søborg is helping to stage a feminist play called Welcome to Denmark. “I’m afraid of a rightwing government. What if they tighten the rules and make it harder for me to claim nationality?’

Like the Red-Green Alliance, Søborg is scathing about Thorning-Schmidt’s humanitarian credentials: “She has a blue mind. She’s like a ‘nice’ Syrian detective who smiles to your face and kicks your arse.” Her dissatisfaction extends across the political spectrum: “Every election they play the immigrant card. We’re the easiest target.”

The Valentine’s Day shootings have undoubtedly influenced the manifesto of the Danish People’s party and shaped the thinking of the Liberal leader. As he left the funeral of security guard Dan Uzan in February, Løkke Rasmussen admitted he was bewildered by the hatred levelled by Hussein towards a society that had offered sanctuary from conflict to his Palestinian parents.

The DPP says it aims to regain control of Denmark’s open borders and to prosecute imams such as Abu Bilal Ismail, a preacher at the radical Grimhøjvej mosque in second city Aarhus, which is accused of sending more fighters to Syria than any other Muslim institution.

Last summer Ismail told worshippers at a Berlin mosque: “Allah destroy the Zionist Jews, they are no challenge to you. Count them and kill them to the very last one. Don’t spare a single one of them.” He insisted that he was exhorting God to exterminate the Jews and was not inciting hatred.

Security in Denmark remains at the highest level. As it tries to prevent a new atrocity, the country’s police force is stretched to such an extent that many crimes are going undetected.

Pollsters have yet to reveal whether February’s shootings will affect voters’ intentions, but the talk among DPP leaders just after the annulment of parliament was whether they would benefit from “shy” supporters, just as the Conservatives did in Britain.

Lars Aslan Rasmussen’s experience may bolster their cause.

Beneath his cap, Aslan Rasmussen had a message for the Salafists: “I may not arrive in paradise, but I will come to Nørrebro station again today. I will never let you set the agenda.”