It was 8pm on Monday when Khaled Idris Bahray told his seven flatmates he was popping out to buy some cigarettes from the Netto supermarket about 100 metres away from his flat in a prefab high-rise in the south of Dresden.

The 20-year-old Eritrean said he wouldn’t be long. But a few hours later he still hadn’t returned. “We assumed he’d gone to stay with some other friends nearby,” said his flatmate, Abdulrezak Suleman. “So we weren’t really worried.”

But around 7.40 the following morning, other residents in the six-storey building found his body slumped in the inner courtyard of the housing estate.

According to his flatmates, in reports that the police will not confirm, he was covered in blood, with at least one deep cut visible on his body. Rigor mortis had already set in. “He was lying on his back, and had blood coming out of his nose and mouth, with drops of blood leading towards the door as if he’d tried to get in, but not made it, and drops on the grass,” said Abdulatif, 23, a fellow Eritrean who lives nearby but had spent that night in Bahray’s flat.

The police had first said there seemed to be no suspicious circumstances surrounding the young Muslim’s death, saying in their initial statement that on first appearance “there are no indications of foul play”. But just hours later they confirmed the results of the postmortem showed that Bahray had been unlawfully killed in what appears to have been a vicious knife attack.

“We now have evidence to confirm that a stab from a knife was the cause of his injuries,” said Dieter Kroll, president of Dresden police. “We can exclude the possibility that this was an accident. It is murder.”

Dresden police have launched a murder investigation in the east German city that has been making headlines recently for its anti-immigrant rallies, which, on the night of Bahray’s death, attracted a record number of 25,000 supporters. Tensions in the city have been high in the 12 weeks since the rallies began, with a reported increase in racist attacks.

The circumstances of Bahray’s killing are now under intense investigation, with police looking into everything, from internal strife within the large group of Eritrean refugees to a racial motive.

On Wednesday night Bahray’s seven flatmates, plus 16 others who had gathered in the men’s flat on the morning his body was found, were being questioned by police, as DNA samples were gathered from all of them.

But while the motive for his killing and the identity of his killer remain unclear, on social network sites the death of the young man prompted a flood of responses, from those who were shocked and horrified to others who expressed malicious glee.

“I cannot fathom this,” wrote one Twitter user. “Especially in Dresden, at this time.”

“A young man has died in our city who had his whole life before him,” a Dresden citizen wrote. “Can’t we find it in us to express our feelings for his relatives and friends?” But others, many of whom openly express their allegiance to the anti-immigration movement Pegida, spouted disdain for the dead Eritrean. “In Africa dozens of children and adults die every day and nobody’s interested in them. But as soon as a single asylum seeker pops his clogs, then the outcry is huge,” wrote Eric van de Hahns on Facebook.

Süsses Tomatchen wrote on Facebook: “They shouldn’t wonder. More and more foreigners are being let in and schools are even being closed to make way for asylum homes … As a result German schoolchildren are having to travel kilometres away to other towns to go to school. This is just the pits.”

A Michael Melzer writing on Facebook said: “That’s at least one less who’s living on our dime,” while Mirco Grosse said: “Get rid of the muck.”

Another said it was unfair to blame Pegida. “If tomorrow ... a cat gets run over, will Pegida be blamed for it?”

The outbursts came a day after Angela Merkel had said it was “humanly reprehensible” to exclude minorities from society. The German chancellor added: “xenophobia, racism and extremism have no place in this country.” The political elite is struggling with how to deal with the growing popularity of Pegida, particularly in the wake of the Paris attacks.

Much of the debate on Facebook, Twitter and other networks focused on blaming Pegida for having forged an atmosphere of hatred and resentment.

But the organisers of the group, who have been famously shy of speaking to the press, told the Guardian that it was absolutely shameful to blame them.

Speaking outside Dresden police headquarters, where they had been meeting police to discuss their forthcoming rally, Pegida’s leader, Lutz Bachmann, said: “This is an internal row, it seems, and to shove the blame on to us is unbecoming. But there are lots of people out there trying to blame us for many things right now.”

The group’s spokeswoman, Kathrin Oertel, said: “We are against extremism in any shape or form. If there is resentment on the streets of Dresden, it was there before we existed.”

But Mekonnen Mesghena, a policy analyst at the Berlin-based Heinrich Böll Foundation, a thinktank affiliated with the German Greens and himself an Eritrean, told the Guardian that it was a very uncomfortable time for refugees in Germany. “They are nervous, and afraid to go out, particularly on Monday nights in cities where protesters are out, and the shock of this will make their lives even more difficult.”

Bahray’s friends and flatmates who were gathered at the police headquarters for questioning told the Guardian their friend had been a peace-loving and kindly man whose main ambition when he left Sudan – where he had lived with his Eritrean mother – four months ago had been to seek a better life.

“He said again and again he just wanted to earn enough money to be able to live and send some back to his mother,” said Tesfalem Negasi, 27, an Orthodox Christian who had shared a room with Bahray. Like all the flatmates, they had met at a German asylum seeker’s home in the Erzgebirge mountains in Saxony on arriving in Germany via Libya and Italy four months ago.

Drawing a swastika on a piece of paper, he said through a translator from Tigrinya into German: “When someone came and drew this on our door one day we started to get wary of going out, particularly after we were spat on and given the finger so many times. We wish after his death, they will think of moving us to a safer part of Germany.”

The Swastika was daubed on the men’s 2nd floor flat just three days before Bahray’s killing. It was accompanied by the slogan “We’ll get you all”.