Daniel Martin Chambers, 25, of Penhale Drive, admitted using threatening behaviour when he appeared before magistrates in Mansfield on Wednesday.
The bench watched CCTV of Mansfield town centre on the night of August 7, which showed Chambers out with six friends as they were approached by two men.
A fight broke out and Chambers threw a punch and kicked one of the men, but then tried to stop his friends from continuing their attack.
David Myles, prosecuting, said: “His involvement was the least of it. But unfortunately for him, he was the only one who was caught.”
Yvonne Wragg, mitigating, said: “Mr Chambers jumps in and pushes his friends away. His group were not the aggressors. They didn’t begin the fight.
“Two men attacked Mr Chambers and his friends. It is very much of out of character for him to have done this. He had only had two pints of lager that night.”
Chambers also admitted possessing a small amount of cocaine for personal use.
The court heard he was convicted for carrying an offensive weapon in 2012.
Greta Percival, of the probation service, said: “He told me he acted on impulse on seeing his friends being attacked.
“It is clear he was aware that his behaviour was unacceptable.
“He said he had used cocaine three times in the last three years.”
Magistrates gave him a 12 month community order, with 200 hours of unpaid work.
He was ordered to pay court costs of £85 and an £85 victim surcharge.