LOS ANGELES — A man who accosted Brad Pitt on a red carpet pleaded no contest to battery Friday and was ordered to stay away from the actor and Hollywood red carpet events.

Vitalii Sediuk entered the plea during a court appearance, two days after he leaped from a fan area and made contact with Pitt at the “Maleficent” premiere. He was sentenced to three years of probation and ordered to attend a year’s worth of psychological counseling.

Sediuk, 25, was also ordered to stay away from Pitt’s partner, Angelina Jolie, and stay 500 yards away from the Hollywood block where movie premieres and the Academy Awards are hosted. He was also ordered to stay away from LA Live, a downtown entertainment complex where Sediuk crashed the Grammy Awards in 2013.

He was charged with four misdemeanors, including assault and two counts governing conduct at sporting and entertainment events. He also pleaded no contest to unlawful activity at a sporting or entertainment event and the remaining counts were dropped.

Sediuk is a former journalist for the Ukrainian television station 1+1, which fired him about three weeks ago.

He has been jailed since Wednesday night and appeared in court in the sport coat and jeans he wore to the “Maleficent” premiere, which stars Jolie. He smiled at times during the hearing and politely answered questions from a judge. His hands remained cuffed for the hearing, and the right sleeve of his sport coat was ripped.