There were no elements of extremism in the attack at a mosque in Malmesbury in the Western Cape where two worshippers were stabbed and killed last month, the Hawks said on Thursday.
Brigadier Hangwani Mulaudzi said in a statement that the attacker had been identified as 23-year-old Nur Arawal from Somalia.
Arawal was an outpatient at Bellville's Karl Bremer psychiatric hospital from 2013 until recently, Mulaudzi said.
Arawal was shot dead by police officers following the attack.
"The motive for the attack is not yet established but there are no links to suggest any involvement of extremists or radical activity. Arawal's remains have been handed over to the family for repatriation and burial."
Mulaudzi said circumstances surrounding the death of Arawal were being investigated by the Independent Police Investigative Directorate. He died after a confrontation with the police.
The attack came at the end of the Muslim holy month of Ramadan, and five weeks after another attack at a mosque in Verulam, KwaZulu-Natal.
At the time, provincial police spokesperson Lieutenant Colonel Andrè Traut said officers were called out to the mosque in the early hours of the morning of June 14, and found two people stabbed to death and several injured.
"As people got themselves ready to pray, the suspect just got up and started stabbing the people. He was praying with them," Malmesbury police's Constable Henry Durant told News24.