Police arrest three terrorists after shootout