The race for New York City mayor is thinning out as Paul Massey announced Wednesday he is ending his campaign.

Citing financial challenges, the Republican candidate in a statement said, “Unfortunately, the cost of running for office is extraordinary, and I do not see a path to raising the necessary funds to beat an incumbent mayor. I am forever indebted to my family, team and my friends for their support." 

In his last filing, the real estate executive reported that he had raised and spent $4.5 million.

Massey’s announcement comes just hours after participating in a GOP debate. 

His decision to leave paves the way for Staten Island Assemblywoman Nicole Malliotakis to become the Republican nominee.

Almost every potential rival has faded: Harlem pastor Michel Faulkner dropped out last month to run for city comptroller; private detective Bo Dietl sought to run as a Republican but filled out his registration card incorrectly and later failed to win his way onto the ballot through the courts. Other potential candidates, like City Councilman Eric Ulrich and supermarket mogul John Catsimatidis, decided against running.

Massey's move came as a surprise, considering he had participated in a debate just Wednesday morning.

He had been an active candidate, holding news conferences and constantly bashing Mayor Bill de Blasio.

Massey had won several endorsements, including from Faulkner, and raised more than $3 million.

But Massey also burned through that money at an astonishing rate, forcing him to loan $2.7 million of his own money to his campaign.

Now, instead of a bruising primary against Massey, who spars a few days a week, Malliotakis is already looking ahead to the general election.

"As the presumptive nominee now, I am ready to go head-to-head with Mayor de Blasio," she said. "And New Yorkers need someone who is going to hold this mayor accountable for his lack of leadership and his mismanagement of the city."

There is no word yet on if or when Massey might endorse his former opponent.