Two women were killed and one person wounded in a knife attack believed to have been carried out by an Afghan refugee at the Ismaili Centre in Lisbon on Tuesday, officials said.
Portuguese police shot the alleged attacker after he refused to lay down a large knife and began to approach them. Officials said he was arrested and taken to hospital.
Ismailis are a minority within Shia Islam whose members have been attacked by extremist groups in countries such as Pakistan.
"It seems to have been an isolated act but the circumstances and motivations are being investigated," home affairs minister Jose Luis Carneiro told reporters.
Prime Minister Antonio Costa said it looked like an isolated act, and it was premature to say any more.
Carneiro said the alleged attacker was a "relatively young man" with three young children. His wife died in a refugee camp in Greece.
The man, who was relocated to Portugal under a European cooperation scheme and had international protection status, lived a "fairly quiet life" and received help at the Ismaili Centre.
The two victims were Portuguese nationals who worked at the centre, SIC television network cited Nazim Ahmed, leader of the Ismaili community in Portugal, as saying. He also said the attacker was an Afghan refugee.
Police did not immediately confirm the nationalities but Carneiro said the man often visited the centre to study Portuguese, collect food donations and for child care. The women worked at the centre's refugee support programme, the minister said.
Ismaili spiritual leader Prince Karim Aga Khan, who claims to be a direct descendent of the Prophet Mohammed, opened the centre in 1998, complete with prayer halls, classrooms, meeting rooms and exhibition spaces.
In 2015, he established the global headquarters of Ismailism in Lisbon under an agreement with the Portuguese government, and in 2018, he made the Henrique Mendonca Palace, also in Lisbon, as the Seat of the Ismaili Imamat.
The Aga Khan Foundation did not respond when called for a comment.
Shortly after the attack, a number of people looking distressed could be seen standing outside the centre amid a heavy armed police presence and were later taken inside. Police officers wearing white crime scene investigation suits also entered the building.
The Ismaili community in Portugal is one of the largest in continental Europe, numbering thousands, including many who fled Mozambique during its civil war.