The Gallery had been considering the gift for over a year, as the controversy around the Sackler family has grown. Nan Goldin, the photographer and anti-opioid activist, drew attention to it last month when she revealed she was in discussions with the gallery over a retrospective. “I have told them I would not do it if they take the Sackler money,” she told The Observer.

The gallery has an ethics advisory committee that provides advice on whether to accept donations. It met shortly after Ms. Goldin’s comments, according to The Art Newspaper. Its advice was confidential and will not be released, a spokeswoman for the National Portrait Gallery said in an email.

“I’m thrilled about the news, and I congratulate them on their courage,” Ms. Goldin said in a telephone interview. “I don’t take credit for it. Maybe I put the last nail in the coffin,” she added, “but they’ve been in discussions for a long time.”

She is still talking with the gallery about a retrospective, she added: “I wish it could be next week.”

Much of the focus on the Sacklers’ donations to art institutions has been in the United States, where deaths and addiction associated with prescription opioids have become an unrelenting crisis. In February, Ms. Goldin, who was addicted to painkillers, and members of a protest group she founded threw scraps of paper meant to look like OxyContin prescriptions from an upper walkway of the Guggenheim Museum in New York, where they floated down on visitors to raise awareness of the donations it has received from the Sackler family.