Transformers star Shia LaBeouf has pleaded guilty to a charge of disorderly conduct over his disruption of a Broadway performance of Cabaret.
Under the terms of the plea, LaBeouf will avoid jail or probation.
However, he must complete a treatment programme, attend all court appearances and avoid arrest for six months.
LaBeouf was arrested in June after smoking, shouting at actors and using abusive language as he was removed from the audience at a Cabaret performance.
According to court documents, he yelled, "do you know who I am?" at security guards at New York's Studio 54 theatre. He later spat at an officer's feet at a nearby police station.
Shortly after the arrest, a publicist for the 28-year-old said the actor had begun receiving treatment for alcoholism.
In New York on Wednesday, Manhattan Criminal Court Judge Diana Boyar asked: "Are you pleading guilty because you are guilty?"
"Yes, your honour," LaBeouf said.
The judge ordered him to complete a three-month course of treatment. The actor made no comment as he left court.
LeBeouf's arrest at the Broadway revival of Cabaret, starring Alan Cumming and Michelle Williams, followed a series of instances where he had behaved erratically in public.
He walked out of a news conference for Lars von Trier's Nymphomaniac at the Berlin Film Festival in February.
The star, whose films include Indiana Jones and the Kingdom of the Crystal Skull and Wall Street: Money Never Sleeps, later appeared on the red carpet with a paper bag on his head, on which was written: "I am not famous anymore."
A month earlier, he had tweeted that he was quitting "public life" because of recent attacks against his "artistic integrity".