Oscar-winning filmmaker Mark Boal said Tuesday that he has agreed on a settlement with the U.S. government that scuttles an Army plan to subpoena 25 hours of recorded interviews with Sgt. Bowe Bergdahl, a soldier who faces court-martial after walking off his base in Afghanistan and being captured by the Taliban.

Boal, whose movies include “The Hurt Locker” and “Zero Dark Thirty,” sued the U.S. government in July after a prosecutor on Bergdahl’s case, Army Maj. Justin Oshana, argued in a court filing that the filmmaker’s interviews were “relevant and necessary to the case.” Bergdahl, 30, faces charges of desertion and misbehavior before the enemy in a trial scheduled to begin in April. If convicted, he faces up to life in prison.

Excerpts from Bergdahl’s interviews with Boal were a centerpiece of “Serial” podcast episodes released between last December and March that explored Bergdahl’s choices and the harsh treatment he received while in captivity. But Boal and news organizations, including The Washington Post, argued that the Army’s request was overly broad and that the service should not be able to use Boal’s newsgathering efforts in a court battle.

Boal said in a phone interview that as part of the settlement, he will provide the Army with about 10 minutes of recordings that authenticate and provide context to conversations that aired on “Serial.” He filed the lawsuit seeking a restraining order on the Army issuing a subpoena.

“I’m definitely happy now because I think the threat of subpoena crossed a line, and it could have set kind of a creepy precedent,” Boal said. “I’m happy and glad that the Army is now back in keeping with the tradition of respecting freedom of the press.”

Boal said he is still considering some combination of a book, movie and documentary about Bergdahl, but that he is putting the project aside until the Army concludes his case. Boal’s lead counsel, Jean-Paul Jassy, said he would file a request for dismissal of the lawsuit Tuesday.

Paul Boyce, a spokesman for the Army, said in an email that the service continues to “maintain careful respect” for the military justice process and Bergdahl’s rights, but declined to comment on the settlement being reached.

Bruce D. Brown, the executive director of the Reporters Committee for Freedom of the Press, said the settlement is an encouraging development in press-government relations in the closing days of the Obama administration. It comes nearly two years after the Justice Department reached an agreement with New York Times reporter James Risen in which he was not required to testify in the case of Jeffrey Sterling, a former CIA officer who was charged with providing Risen information about a failed effort to disrupt Iran’s nuclear program.

“What his lawsuit did was force the government to go to the table and say, ‘Okay, what do we really need to get our case ready for trial?’ ” Brown said of Boal.

Brown’s organization filed a friend-of-the-court brief in support of Boal’s case that had 37 signatories.

Boal began interviewing Bergdahl after he was recovered in 2014 in a controversial swap in which five senior Taliban officials were freed from the U.S. military prison at Guantanamo Bay, Cuba, into supervised release in Qatar. The Obama administration’s decision to do so prompted an outcry from lawmakers who said the detainees could return to the battlefield, and ran afoul of a law that states Congress needed 30 days’ notification, according to a review by the nonpartisan Government Accountability Office.

Administration officials have argued that the White House needed to act while it could to bring home a soldier who went missing on the battlefield. Bergdahl had been held since June 30, 2009, when he was captured by the Taliban hours after he left his patrol base alone with plans to cause a commotion that would draw attention to deficiencies he saw in his unit.

Bergdahl has been a lightning rod for criticism ever since, with fellow soldiers saying he is a deserter and President-elect Donald Trump arguing repeatedly during his campaign that Bergdahl is a “traitor” and should been dropped back off in Afghanistan.

Bergdahl completed a long interview with a senior Army official, then-Maj. Gen. Kenneth Dahl, that was aired in a pretrial hearing in September 2015, but had not been heard from in his own words in public until the second season of “Serial” began last December. Bergdahl told Boal that he fancied himself acting like action hero Jason Bourne on the battlefield before he slipped away from his base, but got lost within hours and was soon captured by Taliban fighters on motorcycles.

Court documents in the case say Bergdahl was diagnosed after his recovery with schizotypal personality disorder, which causes brief psychotic episodes with delusions or hallucinations. Dahl testified last year that he found the soldier “unrealistically idealistic” and to have an “outsize impressions of his capabilities,” but the general did not think Bergdahl deserved jail time on top of the five years of confinement he already endured.

Bergdahl’s legal team recently filed a request for a presidential pardon from President Obama. Dozens of Republican lawmakers have opposed it. The administration acknowledged they have received a request to pardon Bergdahl, but declined to comment on it. As a general rule, they do not discuss pardon requests.