A teenage boy accused of killing a man was "scared" and trying to defend his friends, a court has heard.
Arkadiusz Jozwik, 40, was attacked in Harlow, Essex, on 27 August 2016. He died in hospital two days later.
A 16-year-old boy - who was 15 at the time and cannot be named for legal reasons - denies manslaughter.
Chelmsford Crown Court was told he killed Mr Jozwik with "a superman punch", causing him to fall and hit his head.
The 40-year-old from Poland had been drinking vodka with two friends and had just bought a pizza when he was set upon, the jury was told.
The defendant, who was at The Stow shopping precinct with friends, told the court the men "were being aggressive and loud... swearing, just wobbling everywhere".
He said one of Mr Jozwik's companions made a racist comment to a black youth in the group and tried to grab him.
The teenager told the court he believed "they was going to do something to us, not mostly to me, but to [one of the teenagers] and my friends".
He told defence barrister Patrick Upward QC he was feeling "scared" at that moment and he punched Mr Jozwik "to defend my friend".
When Mr Jozwik, who was also known as Arek, fell and hit his head, the boy ran off, and told the jury: "I just felt like it was a big nightmare."
He said he "felt really sad" about what had happened to Mr Jozwik.
Earlier, prosecutor Rosina Cottage QC told the court the teenager had hit the 40-year-old from behind.
Laughter could be heard just before the assault, the jury heard.
The 16-year-old agreed with her it was "kind of" funny when Mr Jozwik was weaving around and saying "fight me".
The case continues.