In the first 10 weeks of his presidential candidacy, Michael Bloomberg was able to control his image to an almost unprecedented degree, relying on massive amounts of paid advertising to raise his profile in voters’ minds and not participating in debates.

That changed on Wednesday night.

For the first time, Bloomberg qualified for a debate and had to face his opponents in the Democratic primary face-to-face. And his opponents zoned in on him, attacking him on stop-and-frisk, allegations of sexism, criticisms that he’s trying to buy the election, and his history of not previously being a Democrat. In the most aggressive debate yet this primary season, Bloomberg took a large portion of the attacks. And he seemed less than fully prepared to answer questions about his record that were a near-certainty to come up.

This is the problem with running a 30,000-feet campaign that is built on advertising and lavish rallies, keeping the candidate himself at a remove from the fray. It turns out the fray is pretty tough. This is what happened Wednesday night to Bloomberg, who joined the ninth Democratic debate as the other participants had a) gotten used to debating and b) were ready to stop any pretense of being collegial. Bloomberg had not participated in a debate since 2009, and though his team had conducted debate preparations ahead of Wednesday, Bloomberg didn’t seem especially prepared to answer hard questions about issues that were bound to come up — and did — in the debate.

Bloomberg appeared tense and uncertain during portions of the debate, particularly in the first half, which included a rough sequence of questioning around stop-and-frisk.

Bloomberg gave a tangled answer on the issue, saying that “the one thing that I'm really worried about, embarrassed about, was how it turned out with stop-and-frisk” and that the policy “got out of control.” (Bloomberg defended the policing strategy as recently as last year.)

Bloomberg tried to pivot to the other candidates’ records on criminal justice, saying, “If we took off everybody that was wrong off this panel, everybody that was wrong on criminal justice at some time in their careers, there'd be nobody else up here,” but the attempt was stopped short by Elizabeth Warren — who repeatedly went after Bloomberg on Wednesday — accusing Bloomberg of not apologizing for the policy itself.

He faced just as intense a barrage on issues of sexism in the workplace. On the topic of his refusal to release former employees from nondisclosure agreements, Bloomberg again appeared to flail, saying, “None of them accuse me of doing anything other than maybe they didn’t like a joke I told” and trying to change the subject to his hiring and promotion of women. The response earned more scorn from Warren and Joe Biden.

Bloomberg’s campaign acknowledged the problems with his performance in their postdebate spin, though they emphasized that the focus on Bloomberg underscores his increasing importance in the race.

“You know you are a winner when you are drawing attacks from all the candidates,” Bloomberg’s campaign manager Kevin Sheekey said in a statement after the debate. “Everyone came to destroy Mike tonight. It didn’t happen. Everyone wanted him to lose his cool. He didn't do it. He was the grownup in the room.”

“It took Mike just 3 months to build a stronger campaign than the rest of the field had built in more than a year,” Sheekey said. “It took him just 45 minutes in his first debate in 10 years to get his legs on the stage. He was just warming up tonight.”

The campaign has been pushing the notion this week that the primary is functionally a two-person race between Bloomberg and Bernie Sanders, and continued to do so once the debate was over.

“I think by the end of the night the mayor had established a clear contrast with Bernie Sanders on all of the key issues that voters in this party are facing,” Bloomberg senior adviser Howard Wolfson told reporters in the spin room after the debate. “Mike has not been debating for the last year. I think it's fair to say he got better as he went on.”

“These other folks, many of them have been in public life for a very long [time],” Wolfson said. “Many of them had been debating throughout the year. He was definitely better in the second half than the first.”

It’s true that Bloomberg did seem to perk up in the second half, particularly during a feisty exchange with Bernie Sanders in which Bloomberg implied Sanders was a hypocrite for himself being a millionaire who owns three homes.

The debate was a tough dose of reality for a candidate who has been able to set the terms of his own candidacy till now. Instead of putting out whatever message he chose, Bloomberg had to respond to uncomfortable questions and raise his hand just like everyone else. But he still has an unlimited source of funds to buy some more favorable eyeballs before he has to get onstage again next week.

Ruby Cramer contributed reporting.