Interested in Immigration?Add Immigration as an interest to stay up to date on the latest Immigration news, video, and analysis from ABC News.
The president lashed out at other Cabinet members at the White House meeting as well, but the source said Trump's harshest comments were directed at Nielsen.
The president's anger was stoked by Attorney General Jeff Sessions, who remarked that the Department of Homeland Security could just arrest people at the border, the source said.
"Sessions sold her down the river," the source said.
DHS oversees U.S. Customs and Border Protection. Nielsen recently worked with state governors to send contingents of National Guard troops to help secure the border after Trump called for them to do so.
The New York Times, which first reported Thursday afternoon that Trump had berated Nielsen, said that she had told colleagues she was close to resigning, citing several current and former officials familiar with the episode. The Times reported two of them said Nielsen had drafted a resignation letter but had not submitted it.
DHS spokesperson Tyler Houlton said the Times reporting that Nielsen had drafted a resignation letter and was close to resigning is false.
When asked about the episode, White House press secretary Sarah Sanders told ABC News in a statement: "The president is committed to fixing our broken immigration system and our porous borders. We are a country of laws and the president and his administration will enforce them."
Nielsen issued her own statement Thursday evening saying the president is justifiably frustrated but that she is staying on the job.
“The president is rightly frustrated that existing loopholes and the lack of Congressional action have prevented this administration from fully securing the border and protecting the American people. I share his frustration. Border security is the most basic and necessary responsibility of a sovereign nation. These are complex issues and I will continue to direct the department to do all we can to implement the president’s security-focused agenda."
ABC News' Jack Date and Geneva Sands contributed to this story.