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, Thursday'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 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.

And those officials had their own story tell, some rejecting the notion they were slow to act on Trump's expectations for the documents. The CIA began work months ago to get its remaining assassination-related documents ready for release on Thursday, according to a person familiar with the process. The person, who was not authorized to publicly to discuss the process and spoke only on condition of anonymity, said the goal was to have all the agency's documents ready to be released in full or with national security redactions before the deadline.

Since taking office, Trump has challenged the integrity of intelligence leaders, moved to exert more control over U.S. spying agencies and accused his predecessor of using government spycraft to monitor his campaign. In the JFK files matter, one White House official said, Trump wanted to make clear he wouldn't be bullied by the agencies.

Whatever occurred in the lead-up to deadline day, Trump was irritated Thursday that agencies still were arguing for more redactions. The president earlier in the week had tweeted to tease the release of the documents, heightening the sense of drama on a subject that has sparked the imaginations of conspiracy theorists for decades. Under a 1992 law, all of the records related to the assassination were to be made public unless explicitly withheld by the president.