After three years of litigation over the Trump administration’s policy of restricting undocumented minors’ access to abortion, the government on Tuesday agreed to change its policy and to pay more than $330,000 in legal fees and costs to the American Civil Liberties Union, which initiated the challenge.

The parties submitted a joint agreement to dismiss the case, Garza v. Hargan, to U.S. District Judge Tanya Chutkan of the District of Columbia, who has been presiding over the litigation. The suit was filed in 2017 on behalf of Jane Doe, a then-17-year-old Central American immigrant. In 2018, the district court certified a class of pregnant immigrant minors and issued a preliminary injunction against the government.