New York Mayor Bill de Blasio announced Friday he is dropping out of the 2020 Democratic primary, ending his campaign after struggling to gain traction in the race.

"I feel like I contributed all I can to this primary election and it’s clearly not my time," he said during an appearance on MSNBC’s “Morning Joe.” "So I’m going to end my presidential campaign, continue my work as mayor of New York City and I’m going to keep speaking up for working people.”

RUDY GIULIANI BLASTS BILL DE BLASIO'S TENURE AS NYC MAYOR: 'IT BREAKS MY HEART'

De Blasio entered the presidential race in May, running as a proud progressive. But his campaign never caught fire: He qualified for the first two rounds of Democratic presidential debates but has failed to make the cut for the others.

According to the Real Clear Politics average, de Blasio was polling at less than 1 percent nationally. The Democrat had recently hinted that he would end his long-shot bid if he didn't qualify for the October debates.

"I’m going to do everything I know how to get into them," de Blasio said earlier this month.

But Blasio faced an extremely uphill climb to meet the debate thresholds ahead of the Oct. 1 qualifying deadline.

President Trump mocked the mayor in a tweet Friday morning.

"Oh no, really big political news, perhaps the biggest story in years!" the president tweeted. "Part time Mayor of New York City, @BilldeBlasio, who was polling at a solid ZERO but had tremendous room for growth, has shocking dropped out of the Presidential race. NYC is devastated, he’s coming home!"

On his campaign's first day, de Blasio dived into an insult match with Trump. "He's a con artist. I know his tricks. I know his playbook," the mayor said.

Trump tweeted in response at the time 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!"

CLICK HERE TO GET THE FOX NEWS APP

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.

Just this week, Hollywood comedian and lifetime New Yorker Billy Crystal called on the mayor to get out of the race.

“De Blasio, what are you doing in Iowa? You’re going nowhere, come back and clean up this city,” Crystal said on “The Late Show with Stephen Colbert.”

Fox News' Paul Steinhauser and The Associated Press contributed to this report.