The attack took place in the Ismaili Centre, the broadcaster said, adding that the attacker is a native of Afghanistan.
The police neutralized the attacker by shooting him in the leg. He was detained and taken to the hospital.
According to Prime Minister Antonio Costa, everything points to it being "an isolated act".