WASHINGTON — Images of violent clashes between heavily armed police officers and protesters in Ferguson, Mo., have forced the federal government to review its policy of providing local police forces with military-style equipment.

But the Department of Homeland Security on Tuesday wanted everyone to remember the terrifying hours last year after bombs exploded near the Boston Marathon finish line, when police officers wearing camouflage, masks and full body armor went from house to house, hunting for the bombers. After the search ended, neighbors gathered in the streets and cheered.

“Grant funds provided to Massachusetts and to Boston saved lives and restored and ensured public safety in the aftermath of the Boston Marathon bombing,” Brian E. Kamoie, a senior Homeland Security grant administrator, told members of the Senate Homeland Security and Governmental Affairs Committee at a hearing on Tuesday about equipment given to local police departments. His testimony focused heavily on Boston before even mentioning the clashes, and the show of heavily armed officers in Ferguson that prompted the hearing.

That testimony, from the government agency responsible for the largest share of domestic security grants, highlights the political hurdle that Congress and the White House face: Any effort to reverse the longstanding policy of arming and fortifying American cities will run into criticism that Washington is leaving towns unprepared for terrorist attacks.