There was a private lobbying force behind President Trump's change of heart on his controversial policy that resulted in thousands of family separations at the southern U.S. border: first lady Melania Trump.

A White House official confirmed to NPR's Sarah McCammon that Mrs. Trump pressed her husband to act to keep undocumented immigrant families together.

"She's been talking to him about it from the very beginning," the official said, who declined to speak on the record due to the sensitivity of the issue. The first lady's "Be Best" initiative is focused on the well-being of children.

Melania Trump had first weighed in Sunday, issuing a statement via a spokeswoman that she "hates to see children separated from their families and hopes both sides of the aisle can finally come together to achieve successful immigration reform. She believes we need to be a country that follows all laws, but also a country that governs with heart."

The first lady's comments were a departure from the president's approach to the crisis at the time, as the Trump administration has for days — until very recently — blamed Democrats and insisted that only Congress could act to end the family separations by passing changes to the nation's immigration laws.

After Melania Trump spoke out, every other living first lady also condemned the practice of separating children from their parents. In a Washington Post op-ed, Laura Bush called it "cruel" and "immoral." Michelle Obama retweeted Bush's article, writing that, "Sometimes truth transcends party." Hillary Clinton has also spoken out against the practice and on Monday Rosalyn Carter also issued a statement calling the Trump administration's policy "disgraceful and a shame to our country."

There were other Trump family members who also pressed the president to reconsider his stance. NPR's Kelsey Snell reported that when the president met with House GOP members Tuesday he told them that Ivanka Trump, who serves as a White House adviser, has also pushed him to act to stop family separations.

"He mentioned that his daughter Ivanka had encouraged him to end this and he said he does recognize that it needs to end, that the images are painful," Rep. Carlos Curbelo, R-Fla., said. "He discussed the optics and the policy itself and I think he's not comfortable with either."

On Wednesday, the public pressure from both Democrats and Republicans — and private entreaties from his own family — seemed to have finally worked on the president. Trump announced he will sign an executive order to address the issue, though he didn't elaborate on how families detained at the border would be kept together or how detentions would be handled going forward.

"We're going to keep families together but we still have to maintain toughness or our country will be overrun by people, by crime, by all of the things that we don't stand for and that we don't want," Trump said.

Copyright 2018 NPR. To see more, visit http://www.npr.org/.