The young American is facing charges of causing serious bodily harm after his attack on a 41-year-old from Pamplona during the city's San Fermin festival.
His victim is now in critical condition in a medically-induced coma, doctors told the high court of the Spanish region of Navarre.
The attack came after the American saw the man trying to take advantage of his girlfriend, the judge said.
On seeing the incident, the defendant "delivered a single punch" which knocked the "clearly drunk" older man to the ground, the judge said. This is what had caused the victim's serious injury, he added.
The judge also noted that the defendant — who has since apologized for the attack — had not tried to flee the scene.
The US citizen has been released from custody. However, he cannot leave Spain and must report to authorities twice a week, Basque broadcaster EITB reported.
The San Fermin festival draws hundreds of thousands of people to Pamplona every year, many to participate in the famous daily running of the bulls.
But the event is also marked by non-stop partying and drinking with sexual assaults marring past editions.
This year's event saw the unveiling of a campaign designed to stop sexist attacks at the festival.