NEW YORK — When police officers stopped Buddy Valastro for allegedly driving while drunk, he protested that his pastry prowess barred him from arrest.

"You can't arrest me! I'm the Cake Boss!" he told police, according to prosecutors.

Valastro was arraigned Thursday evening at New York City Criminal Court on drunken driving charges. He appeared in a suit jacket and jeans and quietly listened to prosecutors describe what allegedly happened early Thursday morning.

Police spotted Valastro's 2014 yellow Chevy Corvette swerving in and out of his lane on 10th Avenue, according to authorities. Police said his face was flushed, and he was unsteady when he got out of his car.

He repeatedly told the police officers that they didn't need to arrest him, that they could work something out because he isn't "a bad guy," prosecutors said during the arraignment.

"Can you just put me in a cab?" he allegedly asked police. "You don't have to arrest me. I'm not a bad guy."

He also told police that he'd had "a couple of drinks" 30 to 40 minutes earlier, prosecutors said.

After the court appearance, he refused to speak to the horde of reporters stationed outside the courthouse. He and his attorney swiftly got into a black car and drove off. He didn't enter a plea and is due back in court on January 6. Until then, he is barred from driving in New York state.

Valastro later released a statement.

"To all my family, friends, fans and supporters, please know that I want to share and explain to you what happened today and I look forward to doing so at a later date," he said. "I appreciate your support and understanding as we handle things privately as a family."

As he indicated to police, Valastro is best known for his starring role on TLC's reality show "Cake Boss," filmed at his bakery in Hoboken. His arrest came just a few days after he celebrated the grand opening of another bakery in Marlton. Valastro has five other shops in New Jersey.

"We are thankful no one was harmed," Dustin Smith, vice president of communications at TLC, said in an email Thursday night. "This is a personal matter for Buddy and his family.

Before the arraignment, a small group of people were inside Carlo's Bakery in Hoboken. As he came out of the shop, Ricky Villa, 20, said he had traveled from Georgia to visit the the bakery for the first time.

"It was good. It's just how it seems on TV," he said. He said he didn't know anything about Valastro's arrest.

Alex Banda, 18, said he also hadn't heard anything about the drunken driving charges.

"I think that's going to really affect the store," he said.

Kathryn Brenzel may be reached at kbrenzel@njadvancemedia.com. Follow her on Twitter @katiebrenzel. Find NJ.com on Facebook.