(CNN) The Miami schools chief hired to lead New York City schools abruptly backed out of the job during a public meeting Thursday, a move that surprised and frustrated Mayor Bill de Blasio.

De Blasio's office announced on Wednesday that Alberto M. Carvalho would become New York's next school chancellor, CNN affiliate WABC reported

But Carvalho told his board and others gathered at an emergency meeting that he would be staying put in Miami-Dade County, citing his commitment to children.

"I am breaking an agreement between adults to honor an agreement and a pact I have with the children of Miami," Carvalho said, prompting cheers.

Carvalho said he "underestimated the emotional tug, the level of commitment, the power that crying members of the community have had on me."

"Against probably my personal best interest, I am making a decision and announcing a decision today, after speaking with the honorable Mayor Bill de Blasio, that I shall remain in Miami-Dade as your superintendent," he said.

Thank you @BilldeBlasio @NYCSchools and the people of New York City for all you have offered me. I am eternally grateful and appreciative of you and this opportunity. This is one of the hardest decisions I have ever made. — Alberto M. Carvalho (@MiamiSup) March 1, 2018

Mayor: Educators nationwide 'want this job'

The mayor told reporters Thursday he had discussed the next steps with Carvalho on Wednesday night.

"I will say that, I think, like many of you, I was very surprised by Mr. Carvahlo's decision. I thought we had found the right candidate," de Blasio said.

The mayor said Carvalho called him during a break at the Miami-Dade board meeting and "expressed trepidation and concern and ... second thoughts."

"I obviously reiterated to him that he had already accepted the job and we had put out publicly with his agreement," the mayor said. "We had a couple of different conversations and he kept saying to me he didn't think he could take it after all and that was his ultimate decision."

"I think he has been honest today that he did not keep his agreement," the mayor said.

The New York public school system is the largest school district in the country, serving 1.1 million students in more than 1,800 schools.

"Educators all over the country want this job and we've had a huge amount of interest," de Blasio said.

He said Carvalho "told me repeatedly this was his dream job."

"But if he wasn't interested in the job, I don't know why he flew up here several times and had incessant conversations about all the details and agreed to the release of the information publicly," de Blasio said.

De Blasio said New York City schools chancellor Carmen Farina, who already retired, will continue in her role until March.

'Be honest, do right'

Carvalho told his board he struggled with his decision to turn down what he called the "most coveted job in education."

His phone buzzed Wednesday night with hundreds of missed calls and text messages, Carvalho said. He said one of his best friends, a priest, left him a voice mail.

The priest said: "Little brother, no matter where you go, no matter what you do, you're going to do well. Follow your heart, be honest, do right," Carvalho recalled.

He then asked the board for two separate breaks before announcing his decision.

Before de Blasio addressed reporters, his spokesman, Eric Phillips, criticized Carvalho on social media.

"He was a Yes for a week+, until he was a No 15 minutes ago. Bullet dodged."

He was a Yes for a week+, until he was a No 15 minutes ago. Bullet dodged. — Eric Phillips (@EricFPhillips) March 1, 2018

The mayor said that, while he thinks "the world of Eric," he "would not have said it that way."

Carvalho has led the nation's fourth-largest school system since 2008.

In 2014, he was named Florida's Superintendent of the Year and the National Superintendent of the Year.

In a tweet, he thanked de Blasio, the school system and "the people of New York City for all you have offered me."

"This is one of the hardest decisions I have ever made," he wrote.