It was a showdown 25 years in the making: With the world itching to finally get a look at classified Kennedy assassination files, and the deadline for their release just hours away, intelligence officials were still angling for a way to keep their secrets. President Donald Trump, the one man able to block the release, did not appreciate their persistence. He did not intend to make this easy.

Like much else surrounding investigations of the 1963 killing of President John F. Kennedy, this week’s release of 2,800 records from the JFK files was anything but smooth. It came together only at the last minute, with White House lawyers still fielding late-arriving requests for additional redactions in the morning and an irritated Trump continuing to resist signing off on the request, according to an account by two White House officials. They spoke only on condition of anonymity to discuss internal discussions.

The tale of the final hours before the congressionally mandated 25-year release deadline on Thursday adds a new chapter to the story of Trump’s troubled relationship with his spy agencies. He again flashed his skepticism and unpredictability in dealing with agencies long accustomed to a level of deference. Intelligence officials, meanwhile, were again left scratching their heads about a president whose impulses they cannot predict.