Border Patrol
An officer working with the Department of Immigration and Customs Enforcement (ICE) was arrested for multiple charges of sodomy and incest. In this photo, a Border Patrol agent scans the U.S.-Mexico border while on a bridge over the Rio Grande in Roma, Texas, March 13, 2017. Getty Images/ John Moore

President Trump's Acting Head of Customs and Border Protection John Sanders resigned Tuesday amid criticism over the agency's treatment of migrants on the U.S.-Mexico border. He will leave his post on July 5.

"Although I will leave it to you to determine whether I was successful. I can unequivocally say that helping support the amazing men and women of CBP has been the most fulfilling and satisfying opportunity of my career," Sanders wrote.

Sanders had only been at the job for two months and was given the job after his predecessor, Kevin McAleenan, was nominated for acting director of the Department of Homeland Security.

The resignation comes as news agencies and human rights groups reported that the remote Clint border patrol station near the U.S.-Mexico border held 300 migrant children in poor conditions. The facility had a lack of food and water and inadequate sanitation.

Watchdog Human Rights Watch (HRW) reported that some of the children at the facility had been there for up to four weeks. The underage migrants are only supposed to be kept in an emergency shelter for 72 hours.

The outrage caused the U.S. government to move most of the children out of the station.

Illegal immigration has been a major issue in the Trump administration. This past week, Trump claimed he would instruct the Immigration and Customs Enforcement (ICE) agency to round up 2000 undocumented immigrants across the country.

Trump announced on Saturday that he would postpone the raids for two weeks to try to set up a deal with Congress.