WASHINGTON — Democratic leaders in Congress on Wednesday angrily walked out of a White House meeting with President Donald Trump after he had a "meltdown," according to House Speaker Nancy Pelosi.

"What we witnessed on the part of the president was a meltdown. Sad to say," Pelosi told reporters outside the White House with House Majority Leader Steny Hoyer and Senate Minority Leader Chuck Schumer.

The President started the meeting with a lengthy bombastic monologue, according to a senior Democratic aide. He bragged about the "nasty" letter he sent to Turkish President Recep Tayyip Erdogan over the Turkish leader's decision to invade northern Syria, the aide said.

The meeting quickly devolved into a series of contentious exchanges centering on the president's decision earlier this month to pull troops from Syria, which paved the way for the Turkish invasion. The White House called the meeting to discuss the president’s decision and the deescalating situation on the ground. Ahead of the meeting, the House overwhelmingly voted in favor of a resolution rebuking Trump’s decision to pull troops out in a 354-60 vote.

"I think that vote, the size of the vote — more than 2 to 1 of the Republicans voted to oppose what the president did — it probably got to the president, because he was shaken up by it," Pelosi said. "That's why we couldn't continue in the meeting because he was just not relating to the reality of it."

At one point during the meeting, Schumer brought up former Defense Secretary James Mattis, who told NBC's "Meet the Press" on Sunday that Trump's decision to pull troops from Syria could lead to ISIS's resurgence.

According to multiple aides, Trump called Mattis, "the world's most overrated general."

"You know why?," Trump said, according to one aide. "He wasn't tough enough. I captured ISIS. Mattis said it would take two years. I captured them in one month."

In another heated encounter, Pelosi challenged Trump on Russia's involvement in Syria, saying "All roads with you lead to Putin."

The Democratic leaders said that the moment that prompted them to abruptly leave was when Trump called Pelosi "a third-rate politician" to her face.

According to the senior Democratic aide, Hoyer stated, "This is not useful."

Pelosi and Hoyer then stood up and left the meeting, the aide said.

As they left said, Trump shot back, "Goodbye, we'll see you at the polls."

Schumer followed shortly thereafter.

"He was insulting, particularly to the speaker," Schumer told reporters later on Wednesday. "She kept her cool completely. But he called her a third-rate politician. He said that there are communists involved and you guys might like that. I mean, this was not a dialogue. It was sort of a diatribe — a nasty diatribe not focused on the facts, particularly the fact of how to curtail ISIS, a terrorist organization that aims to hurt the United States in our homeland."

Hoyer echoed those remarks, saying that the meeting "deteriorated into a diatribe" and that they were "deeply offended" by the way Trump treated Pelosi. He said that after serving in Congress over the course of six presidential administrations, he has "never" seen a president "treat so disrespectfully a co-equal branch of the government."

White House Press Secretary Stephanie Grisham denied the Democrat's characterization of the meeting, saying, "The President was measured, factual and decisive, while Speaker Pelosi’s decision to walk out was baffling, but not surprising. She had no intention of listening or contributing to an important meeting on national security issues. While Democratic leadership chose to storm out and get in front of the cameras to whine, everyone else in the meeting chose to stay in the room and work on behalf of this country."

Trump later tweeted a series of photos from the meeting, including one that he labeled, "Nervous Nancy's unhinged meltdown." Pelosi later made the image her cover photo on Twitter.

“Nancy Pelosi needs help fast!,” Trump later tweeted. “There is either something wrong with her “upstairs,” or she just plain doesn’t like our great Country. She had a total meltdown in the White House today. It was very sad to watch. Pray for her, she is a very sick person!”

Republicans, who stayed behind in the meeting, spoke to reporters afterward. House Minority Leader Kevin McCarthy, R-Calif., said that Pelosi stormed out of the room, calling it "unbecoming" of the speaker.

"It's very disappointing to see the Democratic leadership walk out of this meeting," he said.

"When there is a time of crisis, leaders should stay" whether they like what they’re hearing or not, he added.

When NBC News asked Senate Majority Leader Mitch McConnell about Trump's criticism of Pelosi and the meeting more broadly, he said, "I didn’t have anything to say in the meeting, and I don’t have anything to say about it now."

The dramatic meeting comes amid the House's ongoing impeachment inquiry. Democrats on Wednesday said that impeachment did not come up during their conversation with the president.

The episode was reminiscent of the White House meeting Trump held with congressional leaders in May on the nation’s infrastructure, during which Pelosi said that Trump threw a "temper tantrum" and "stormed out" of the room. Trump said at the time that he would only work with Democrats if they stopped investigating him.