In a series of raids in suburban New York in 2006 and 2007, agents of Immigration and Customs Enforcement burst into private homes in the dead of night, without warrants, looking for undocumented immigrants, often in the wrong houses.

They pounded on doors, terrorized innocent residents, ineptly drew guns on police officers who were supposed to be their partners, and found hardly any of the gang members they were hunting. It was a stunning display of aggression and incompetence.

It took six years, but the lawsuit filed after the raids finally ended last week, with a settlement approved by a federal district judge in New York. Under the agreement, ICE agents will now have to honor some elementary norms of the Fourth Amendment, which bars unreasonable searches.

Its agents will be forbidden to invade private homes without "a reasonable, articulable suspicion of danger." When they have no warrant and need consent to enter a private home, they will have to ask permission in a language the resident understands, "whenever feasible."

They must also get permission to enter yards and other private areas adjoining homes. The federal government will pay $1 million in damages and fees, including $36,000 to each of 22 plaintiffs.

The raids, part of a series of ICE home invasions in many states, were outrageous, but so was some of the reaction on Long Island, where several victims lived. The Nassau County police commissioner, Lawrence Mulvey, rightly condemned the botched "cowboy" operation. But in Suffolk County, where County Executive Steve Levy was stoking a climate of intolerance against immigrants, his police commissioner, Richard Dormer, defended ICE, even though homes in Suffolk had been invaded and children traumatized by mistake.

George W. Bush's administration was a bad time for immigration enforcement run amok. Six years is a long time to wait to undo some of the damage done in those raids.

But the era of excess is not over. President Barack Obama's administration has handled enforcement more quietly, but it has doggedly outdone its predecessor in sheer magnitude -- 400,000 deportations a year, a record pace that is not letting up.