"If the 1994 or 2003 version of Mitt Romney were running ... I may well have voted for him," the mayor wrote

Receive the latest national-international updates in your inbox

His endorsement, announced in an op-ed on Bloomberg View, comes five days before Election Day.

With just five days left before Election Day, New York City Mayor Michael Bloomberg announced his support for President Barack Obama in an unexpected endorsement prompted by the devastation wrought by Hurricane Sandy.

The mayor, a political independent, who has been a sharp critic of both Obama and Romney, explained in an op-ed article for Bloomberg View that the superstorm—the second in 14 months to force evacuations in parts of New York City— "brought the stakes of next Tuesday's presidential election into sharp relief."

Election 2012: A Look Back

It was Obama's environmental policies that ultimately swayed the influential mayor. "Our climate is changing," Bloomberg wrote in the piece titled "A Vote for a President to Lead on Climate Change."

"While the increase in extreme weather we have experienced in New York City and around the world may or may not be the result of it, the risk that it might be—given this week's devastation—should compel all elected leaders to take immediate action," he added.

Star Power: Celebrities on Team Obama

Bloomberg praised Obama's efforts to reduce carbon consumption, noting the president's work to raise fuel-efficiency standards and to adopt tighter controls of mercury emissions. But he balanced that praise with a hefty dose of criticism.

"As a president, he devoted little time and effort to developing and sustaining a coalition of centrists, which doomed hope for any real progress on illegal guns, immigration, tax reform, job creation and deficit reduction," Bloomberg wrote. "And rather than uniting the country around a message of shared sacrifice, he engaged in partisan attacks and has embraced a divisive populist agenda focused more on redistributing income than creating it."

He also expressed disappointment in Romney's shifted views on the environment, immigration, abortion rights, illegal guns and health care, noting that, "If the 1994 or 2003 version of Mitt Romney were running for president, I may well have voted for him, because, like so many other independents, I have found the past four year to be, in a word, disappointing."

He did praise Romney's business experience and called him "a good decent man," but boiled his final decision down to the following observations:

"One believes a woman's right to choose should be protected for future generations; one does not ... One recognizes marriage equality as consistent with America's march of freedom; one does not ... One sees climate change as an urgent problem that threatens our planet; one does not."

He added that neither candidate "has specified what hard decision he will make to get our economy back on track while also balancing the budget" but said that what matters more is finding bipartisan solutions, which he noted Obama could do by listening "to people on both sides of the aisle" and by building the trust of moderates.

Obama said he was "honored" to have the mayor's endorsement.

"While we may not agree on every issue, Mayor Bloomberg and I agree on the most important issues of our time," Obama wrote in a statement. "That the key to a strong economy is investing in the skills and education of our people, that immigration reform is essential to an open and dynamic democracy, and that climate change is a threat to our children's future, and we owe it to them to do something about it."

The president added that he appreciates "the extraordinary job [Bloomberg is] doing" to help his city rebound from the devastation left in Sandy's wake, and vowed to stand by New York in its time of need.

“New Yorkers have my word that we will recover, we will rebuild, and we will come back stronger."

Three days after an unprecedented storm surge inundated parts of New York City that had never been under water, the city’s death toll had ticked up to 37, more than half a million homes and businesses were still in the dark, and the city’s transit system remained crippled.

The mayor noted in his endorsement that efforts made on the local level to take on the sort of extreme weather that had blighted parts of his city were not enough. “We need leadership from the White House.”

Bloomberg, who is in his third term as mayor, recently established a super PAC to support state, federal and local candidates from any political party, as well as independents, who share his views on same-sex marriage, gun control or school reform, The New York Times reported.

He plans to spend $10 million to $15 million of his own money to “influence national policy" around those issues one adviser told the Times.

Bloomberg endorsed President George W. Bush in 2004 and did not endorse any candidate in 2008.