Ruling allows group to take mosque fight to court