The incident occurred during a match between Second Division Andaluza Sénior and fellow Andalusian team CD Abes in Granada on Sunday.
Referee Jesús Lorenzo Rodríguez wrote in his notes that in the 80th minute of the match, a man "invaded the pitch and approached assistant number one and tried to hit him with his penis, which he had pulled out beforehand".
The man was identified “clearly and unequivocally” as a player from a rival club, Céltic de Pulianas C.F, which is also based in the southern Spanish region of Andalusia, but in the First Division.
"He was wearing the team’s tracksuit and I recognized him from when he’d refereed in the past," the referee wrote in his match notes, according to Spanish news agency Efe.
Despite the unfortunate incident, the match continued and the home team won 3-2.