Grant Robertson, 28, launched a tirade of abuse at the three men following the incident on 26 January.
At Dundee Sheriff Court, Robertson pleaded guilty to a charge of acting in a racially aggravated manner and to assaulting the men. Sheriff Elizabeth Munro released him on bail ahead of sentencing next month.
The court heard that when he was arrested Robertson told police: “I threw my sword out the window at them, I wish it got them in the throat.”
Dundee Sheriff Court was told that Mahmut Turk had been praying in his flat in the city’s Craigmount Road at about 00:10 on the night of the incident when he smelled smoke.
He woke his roommate Yusuf Akhaya, who called the emergency services, and then rushed from the flat, where they met their other roommate, Emre Sezen. But as they waited for the fire brigade, Robertson climbed out of his first floor window and began his tirade.
Fiscal depute Trina Sinclair told the court: “Police attended with the fire brigade and went in to make inquiries. The accused then came to the window of the property and started shouting at the three men, saying things like ‘I will kill you all’ and ‘Muslim bastards’.” She told the court Robertson then disappeared from the window and came back brandishing the weapon.
Ms Sinclair said officers could see the accused hanging out the window shouting and swearing. She added: “Police attended his property and spoke to him through the door, but he continued shouting and swearing and making racial remarks.”
The fiscal depute said Robertson was taken to police HQ and charged with attempted murder. She told the court: “In reply he said ‘I never attempted to murder. If I was going to murder him I would do’.”
Police had originally charged Robertson, who has previous convictions for assault, breach of the peace and vandalism, with attempted murder.
Defence solicitor Ross Bennett reserved his plea in mitigation for a later sentencing date. Sheriff Elizabeth Munro released Robertson on bail ahead of sentencing next month. She said: “That doesn’t mean I’m not considering a custodial sentence.”