Actor 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 said he has had treatment for an alcohol problem since his June arrest, sombrely 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 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".
Outside court, Mr Gage declined to detail the treatment. LaBeouf's publicist said in July he was voluntarily being treated for alcoholism but had not checked into a rehab facility.
It is not uncommon in Manhattan for such cases to be resolved with agreements to dismiss them if a defendant stays out of trouble.
Best known for starring in the first three Transformers movies, LaBeouf has had attention for a number of off-screen incidents in the past year.
He apologised for borrowing the storyline 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 was arrested on a drink-driving charge in Los Angeles in 2008 after he crashed his pick-up truck, injuring his hand and knee; police said he was not at fault for the wreck, as another driver had run a red light. Prosecutors ultimately said there was not enough evidence to charge him.