NEW YORK — New York City Mayor Bill de Blasio has ended his campaign for the 2020 Democratic presidential nomination.

De Blasio struggled to gain traction in a sprawling field of Democrats seeking the presidency. He announced his decision in an MSNBC interview on Friday.

De Blasio launched his bid in May, but his campaign largely failed to take off.

De Blasio says he feels he's contributed all he can "to this primary election." He tells MSNBC's "Morning Joe" show "it's clearly not my time."

The mayor had announced his presidential run by heading to the Statue of Liberty, where he said the country is in an "identity crisis" around immigration, which he called "the founding and unifying element of the American experience."

"We are figuring out who we are," he said then. "There are American values we need to return to and fight for in order to achieve our greatest potential."

On his campaign's first day, he dived into an insult match with President Donald Trump.

"He's a con artist. I know his tricks. I know his playbook," the mayor said.

Trump tweeted that de Blasio was "considered the worst mayor in the U.S."

The Republican president said, "He is a JOKE, but if you like high taxes & crime, he's your man. NYC HATES HIM!"

When de Blasio took office in 2014, he seemed briefly poised to become a leading voice for an emerging left wing of the Democratic Party. His central message was fighting income inequality, a theme he hit in the video announcing his presidential candidacy.

"There's plenty of money in this world. There's plenty of money in this country. It's just in the wrong hands," he said.

Liberal enthusiasm faded during his first term, partly because of political missteps at home and the emergence of bigger names elsewhere. He faced obstacles trying to distinguish himself in a crowded field.