Over the past decade, dozens of Immigration and Customs Enforcement agents and contract guards responsible for the detention and removal of undocumented immigrants have been arrested and charged with beating people, smuggling drugs into detention centers, having sex with detainees and accepting bribes to delay or stop deportations, agency documents and court records show.