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 Friday afternoon, 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 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 earlier Friday 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 roughly three weeks ago.

Sediuk, who was jailed Wednesday night, 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.

Sediuk was released from custody later Friday. His attorney Anthony Willoughby said he expected the stay-away orders against his client to be lifted after a year if his client behaves.

Sediuk’s antics have repeatedly brought him too close for comfort to Hollywood’s elite. In 2011, Sediuk presented Madonna with a bouquet of hydrangeas at the 2011 Venice Film Festival, prompting the singer to express her disgust for the flowers. The following year, he attempted to kiss Smith on the mouth on a red carpet in Moscow, prompting a slap from the actor.

In 2013 he grabbed a microphone before Adele accepted a Grammy Award, which led to Sediuk’s arrest. He later pleaded no contest to trespassing and earned him a three-year probation sentence.

He hugged Bradley Cooper’s crotch earlier this year at the Screen Actors Guild Awards and streaked down a runway in a G-string at a show during February’s Fashion Week in New York City. No charges were filed after either incident.