Shia LaBeouf has admitted to acting up at a Broadway show, pleading guilty to disorderly conduct in one of several episodes of bizarre behaviour the former Transformers star has displayed in recent years.
LaBeouf, whose representatives say has received treatment for an alcohol problem since his June arrest, answered a judge's questions as he pleaded guilty in a deal that involves no jail time or probation.
If he stays in treatment for at least three months and out of trouble for six, he will be allowed to withdraw the guilty plea and the case will be dismissed.
"Are you pleading guilty because you are guilty?" Manhattan Criminal Court Judge Diana Boyar asked, a standard question in such pleas.
"Yes, your honour," LaBeouf said.
He declined to comment as he left court encircled by news cameras.
"We appreciate the thoughtfulness of the resolution of the matter by the (Manhattan) district attorney's office," said his lawyer, G. Robert Gage.
LaBeouf, 28, was watching Alan Cumming and Michelle Williams in a Cabaret revival on June 24 when he started smoking cigarettes, yelling at the actors on stage, and swearing at security guards and shouting as he was escorted out: "Do you know who I am?" according to court papers.
Taken to a police precinct, he also spat at an officer's feet, according to the documents.
He faced charges including a misdemeanour trespassing offence and some non-criminal violations, disorderly conduct among them.
Assistant District Attorney Alyssa Russell told the judge that prosecutors had made the plea agreement "based on the fact that the defendant has been in continuous treatment since his arrest".
Gage says LaBeouf has been treated at the Hills Treatment Centre in Los Angeles, but declined to provide details.
LaBeouf's publicist said in July he was voluntarily being treated for alcoholism, but hadn't checked into a rehab facility.
Best known for starring in the first three Transformers movies, LaBeouf has received attention for a number of off-screen incidents in the past year.
He apologised this winter for borrowing the story line and dialogue for a short film from a graphic novel writer.
In February, he walked out of a Berlin Film Festival news conference for the movie Nymphomaniac Volume I and then wore a paper bag - emblazoned with "I am not famous anymore" - over his head at the red carpet premiere.
The actor also was arrested on a drunken driving charge in Los Angeles in 2008 after crashing his pickup truck and injuring his hand and knee, but police said he wasn't at fault for the wreck, as another driver had run a red light.