WASHINGTON — House Speaker Nancy Pelosi, D-Calif., on Wednesday appeared to issue a warning to Democrats during a closed-door caucus meeting for attacking their colleagues publicly rather than raising concerns privately during the recent fight over legislation addressing the border crisis.

“You got a complaint? You come and talk to me about it. But do not tweet about our members and expect us to think that that is just OK,” Pelosi said, according to a senior Democratic aide who was in the room.

“Our diversity is our strength, but our unity is our power. And without that unity, we are playing completely into the hands of the other people,” she added.

Pelosi made the comments during House Democrats’ first caucus meeting since returning from their weeklong July 4 recess, and deep divisions that emerged over the border bill that ultimately passed the House and the Senate and was signed into law by President Donald Trump in late June. Progressives said the bill gave Trump too much latitude in dealing with migrants, including children, at the border.

Pelosi said that Senate Majority Mitch McConnell, R-Ky., would have been “very happy” if the House had passed nothing.

“He doesn’t care about the children,” she said. “But to have nothing go to the children — I just couldn’t do that. I’m here to help the children when it’s easy and when it’s hard. Some of you are here to make a beautiful pâté but we’re making sausage most of the time.”

One Democratic member in the room told NBC News that Pelosi’s comments came across “the way a strong mother speaks to her arguing children: stern, with a good dose of consequences if it continues.”

After Pelosi agreed to hold a vote on the Senate-passed border measure, Rep. Mark Pocan, D-Wis., blasted his more moderate Democratic colleagues on the bipartisan Problem Solvers Caucus for pushing the legislation instead of siding with progressives who sought to challenge it.

Pocan tweeted late last month, “Since when did the Problem Solvers Caucus become the Child Abuse Caucus? Wouldn't they want to at least fight against contractors who run deplorable facilities? Kids are the only ones who could lose today.”

Since when did the Problem Solvers Caucus become the Child Abuse Caucus? Wouldn't they want to at least fight against contractors who run deplorable facilities? Kids are the only ones who could lose today. — Rep. Mark Pocan (@repmarkpocan) June 27, 2019

The member in the room Wednesday said Pelosi's remarks were also aimed at Rep. Alexandria Ocasio-Cortez’s chief of staff, who attacked Pelosi and compared moderate Blue Dog Democrats to segregationists in a tweet over the weekend.

"They certainly seem hell-bent to do black and brown people today what the old Southern Democrats did in the 40s," Saikat Chakrabarti wrote on Twitter. He later deleted the tweet.

"Our caucus is very upset about some of the comments that have come from the staffs," Pelosi told reporters leaving the meeting Wednesday.

During the meeting Wednesday, Pelosi said she also wanted to share a message from House Majority Leader Steny Hoyer, D-Md., to the caucus.

“This is a team. On a team, you play as a team,” she said. If you want to be not on the team, that is okay because that is part of the team spirit — you just want to not play in that round.”

Pelosi also addressed the split in her caucus.

“While we’re on the subject of family, let me just say, in every family you have your moments — right, do you not have your moments in your family? Do you all agree all the time on everything — do you? Everybody agrees all the time in your family? Who raised their hand?”

Her team pushed back on the idea that she was taking a swipe at more liberal members of her party.

"The Speaker was not scolding progressives," spokesman Drew Hammill said on Twitter. "She was saying to all Members that we as a family should have our conversations together as a Caucus not on Twitter. This was a general comment not aimed at any particular Member or group. This was a unifying speech & well received."

Pelosi downplayed the influence of four progressive freshman members of her caucus in an interview published Saturday with New York Times columnist Maureen Dowd: Ocasio Cortez of New York, fellow Reps. Ilhan Omar of Minnesota, Rashida Tlaib of Michigan and Ayanna Pressley of Massachusetts.

“All these people have their public whatever and their Twitter world,” Pelosi said. “But they didn’t have any following. They’re four people and that’s how many votes they got.”

Pelosi allies, meanwhile, have tried to tamp down the tensions. “It’s all puppies and rainbows,” Rep. Hakeem Jeffries, D-N.Y., said Wednesday at a Democratic leadership press conference.