LOS ANGELES (AP) — A federal judge has ruled that the U.S. government must seek consent before administering psychotropic drugs to immigrant children held at a Texas facility.

U.S. District Judge Dolly M. Gee issued a ruling Monday that the federal government violated portions of a longstanding settlement governing the treatment of immigrant children caught crossing the border.

Gee says the government must obtain consent or a court order to give children psychotropic medications at a Texas facility under state law unless it's an emergency.

She also says officials must tell children in writing why they are in a secure facility and that gang affiliation alone doesn't justify such placement.

The decision comes as the Trump administration has toughened policies toward immigrant children and families caught crossing the U.S.-Mexico border.