The suspect, who was shot dead by police, is believed to have had a connection to the place of worship.