The archives had initially defended the decision to alter the images.

“As a nonpartisan, nonpolitical federal agency, we blurred references to the president’s name on some posters, so as not to engage in current political controversy,” Miriam Kleiman, a spokeswoman for the agency, said in a statement to The Washington Post, which first reported on the changes.

But following the burst of public fury, officials at the museum took down the photo and apologized.

“We made a mistake,” the agency said in a statement. “This photo is not an archival record held by the National Archives but one we licensed to use as a promotional graphic. Nonetheless, we were wrong to alter the image.”

In a reflection of the country’s highly polarized climate, the National Archives and other agencies that are usually seen as inoffensive have provoked criticism in their handling of records and photos — and in their efforts to avoid controversy.

This month, the National Archives issued a statement countering accusations that it was allowing for the destruction of millions of documents about the mistreatment of immigrants.

In 2019, the Library of Congress removed from an exhibit a large mural depicting protesters at the Women’s March because there were concerns the image might appear critical of Mr. Trump, according to The Post.

In an email to the photographer last May, Betsy Nahum-Miller, the library’s senior exhibition director, wrote the photograph had to be removed because “there were a couple of anti-Trump messages that appear very clearly in the image,” The Post reported.

And after an employee at the National Park Service retweeted photos comparing the inaugural crowds of 2009 and 2017, Mr. Trump called the agency’s director and asked if he could produce photos that would show the crowds at his inauguration were bigger than the news media had reported.