The shooter was later found dead a few hundred metres from the Islamic Centre where the crime took place, and is believed to have killed himself.
Police had already been searching for him in connection with the discovery of a body on Sunday morning in a park in Zurich.
The victim in the park, also 24, died after being stabbed several times, said police.
He knew his attacker.
In the course of their investigations police established that the gunman was also responsible for the stabbing in the park.
No motive for the shooting or the stabbing has yet been discovered, however there is no indication of any connection to terrorism, said Lentjes Meili.
She added that the attacker may have had links to the occult.
“Corresponding symbols have been found at his home,” she said.