Ed Koch was former mayor of New York City. Reuters

Former New York City Mayor Ed Koch on Tuesday endorsed President Barack Obama after slamming his Israel policy for months, now praising his United Nation speech against Palestine's bid for statehood.

Koch, a Democrat whose political ideology has never been easy to pin down, endorsed Obama's reelection campaign after the blunt mayor aired his displeasure at the administration's policies on Israel during a special election in which he endorsed a Republican.

But Obama's U.N. speech has assuaged Koch, who said he personally praised the President's speech for acknowledging Israel's presence in a difficult neighborhood. Koch also appreciated Obama's efforts to protect Israeli diplomatic personnel in Egypt, and provide military technology and intelligence, far exceeding his predecessors, the former mayor said.

I am now on board the Obama Reelection Express, Koch wrote in an email to supporters.

Koch's criticism of Obama was amplified during a special Congressional election in a Brooklyn and Queens district to succeed Anthony Weiner, who resigned following his admission that he sent salacious photos of himself to women through Twitter.

Koch, also a former congressman from Manhattan, had endorsed Republican television executive Bob Turner over Democratic state lawmaker David Weprin to send a message to Obama about his call for Israel to negotiate a peace agreement with Palestine based on 1967 borders with mutual land swaps.

With support from the district's bloc of conservative Orthodox Jewish voters, Republicans scored a coup in wresting the seat from Democrats this September. After the September election, Koch even suggested he would take his criticism of Obama on the road, targeting Jewish voters.

Whatever rift existed before -- and there was -- that's gone, Koch told The New York Times. He's got me to go out there and persuade them. I have shoes, will travel.

Koch, who served as mayor of New York City from 1978 to 1989, had endorsed Obama for president in 2008, only four years after backing President George W. Bush for reelection in 2004.