A federal appeals court on Friday sided with reporters and a press freedom group in a case that began years ago when the FBI impersonated an Associated Press reporter.

The case stems from a 2007 investigation in which an FBI agent pretended to be an AP reporter during an investigation into bomb threats emailed to a Washington state high school.

The Reporters Committee for Freedom of the Press and AP filed a Freedom of Information Act in 2014 request to obtain more documents from the FBI and Department of Justice for more documents, which included information on the high school incident, other times the FBI has impersonated a member of the news media and the agency’s policies and guidelines for impersonation.

The federal government turned over no records, so the two organizations sued in 2015. The government then turned over roughly 200 pages of records — though most of the pages were redacted — and a lower court ruled that the government had “conducted a good-faith, reasonable search” in searching for and releasing the documents it did.

But on Friday, the U.S. Court of Appeals for the District of Columbia Circuit said the FBI failed to demonstrate that it did a thorough search for the records requested by the two organizations.

“This decision is a significant victory in our effort to help reporters and the public better understand law enforcement practices for impersonating the news media,” said Katie Townsend, litigation director for the Reporters Committee. “These practices undermine the media’s credibility and could make sources wary of trusting journalists in the future. The public has a right to this information.”

Judge David Tatel wrote the opinion for himself and his colleagues, which said that the FBI “failed to demonstrate” that it conducted a search “for the requested records, using methods which can be reasonably expected to produce the information requested.”

The case now returns to the lower court.