NEW YORK -- Former U.S. Defense Secretary Jim Mattis is laughing off an insult hurled at him by President Donald Trump.

Speaking at a New York charity event Thursday, the day after Trump demeaned him as "the world's most overrated general," Mattis joked that he took it as a compliment.

"I'm not just an overrated general. I'm the greatest, the world's most overrated," he told diners at the annual Alfred E. Smith Memorial Foundation Dinner.

"I'm honored to be considered that by Donald Trump because he also called Meryl Streep an overrated actress," he said. "So I guess I'm the Meryl Streep of generals, and frankly that sounds pretty good to me."

Related: Sound Off: Is Mattis 'Overrated'?

Trump lashed out at his former defense secretary Wednesday, during a contentious White House meeting with members of Congress.

The meeting was intended to be a bipartisan discussion of Trump's decision to pull U.S. forces from northern Syria, but it broke up after a testy exchange between Trump and House Speaker Nancy Pelosi.

Before the walkout, Trump disparaged Mattis, who had argued as defense secretary that U.S. troops were needed in Syria to prevent a resurgence of Islamic State fighters.

Trump said Mattis was "the world's most overrated general. You know why? He wasn't tough enough."

"I captured ISIS," Trump went on to say.

Mattis resigned as defense secretary last December after Trump said he intended to pull 2,000 American troops out of Syria. In his resignation letter, the retired Marine general told Trump he had "the right to have a Secretary of Defense whose views are better aligned with yours."

Since then, he has largely refrained from publicly criticizing the administration, saying he owed the commander in chief "a duty of silence."

But he did save a zinger for Trump at the laughter-filled gala, saying the "overrated" moniker didn't bother him.

"I earned my spurs on the battlefield ... and Donald Trump earned his spurs in a letter from a doctor," Mattis joked.

On a serious note, Mattis alluded to Trump's decision to have U.S. troops stand down in Syria, clearing the way for Turkey to launch an offensive against Kurdish forces who had been U.S. allies in the fight against the Islamic State group. On Thursday, the U.S. and Turkey agreed to a five-day cease-fire that requires the Kurdish fighters to vacate, largely solidifying Turkey's position in the region.

"We owe a debt to all who fought for liberty, including those who tonight serve in the far corners of our planet, among them the American men and women supporting our Kurdish allies," Mattis said.

The annual gala draws luminaries from finance and politics. Hosted by Cardinal Timothy Dolan, the archbishop of New York, the benefit is named after a former New York governor who was the first Catholic to receive a major party nomination for president in 1928, before losing the general election.

-----

This article was written by Tom McElroy from The Associated Press and was legally licensed through the NewsCred publisher network. Please direct all licensing questions to legal@newscred.com.

Read more: Marine Corps Announces It Was Wrong -- Again -- on Iwo Jima Flag-Raising Photo