A firearm was discharged outside York Mosque, leading to an arrest and closure of the centre.