Would-be assassin John W. Hinckley Jr. became “momentarily fixated” on a Barnes & Noble shelf that contained a book about the assassination of President McKinley and one that featured a photograph of President Reagan on its cover, a Secret Service agent testified Monday.

The agent, Jason Clickner, testified in hearings before a federal judge called to determine whether Hinckley should be granted more freedom from the psychiatric hospital where he has been held since being found not guilty by reason of insanity for shooting President Reagan and three other men in March 1981.

In recent years, Hinckley has been granted more freedom from the hospital and has been allowed to visit his mother’s Virginia home for 10-day stretches without hospital personnel.

The hospital is asking U.S. District Judge Paul L. Friedman to expand those visits and to grant its doctors the authority to place him in his mother’s hometown of Williamsburg on a full-time basis.

Hinckley’s doctors and lawyer, Barry Wm. Levine, say the presidential assailant is no longer a danger to himself or others and should be granted more privileges.

Federal prosecutors are fighting the proposal, arguing that Hinckley cannot be trusted with such freedom and remains a potential threat. They have said they were particularly concerned about what Hinckley may have scrutinized during unscheduled visits to a Barnes & Noble bookstore in Williamsburg.

Clickner testified about one of those visits. On Oct. 16, Clickner said he was going to conduct surveillance of Hinckley who was scheduled to attend a movie at a Williamsburg theater at 1:30 p.m. In preparation for the surveillance, Clickner was checking out nearby buildings and was in a Barnes & Noble when he suddenly saw Hinckley enter the bookstore at 1:02 p.m. The agent watched Hinckley go to the store’s history section and become fixated for 15 to 20 seconds on a particular shelf. As he walked away, Hinckley kept his eyes on the shelf, the agent testified.

On that shelf was a book about the assassination of President McKinley and another about how President Reagan broke the air traffic controllers’ strike in August 1981. A photograph of Reagan is on the cover of that book, “Collision Course,” by Joseph McCartin.

“When I saw that,” the agent said, “I had an involuntary response of goosebumps.”

On cross examination, Clickner testified that there was a chance Hinckley may have been looking at the shelf above the one containing those books.

Hinckley, a songwriter and avid guitarist, purchased two books at the store — one about Elvis Presley and one about Bob Dylan, Clickner said. Hinckley then went to the theater and watched the movie “Moneyball.”

On two earlier scheduled trips to the movie theater, prosecutors said, agents watched Hinckley skip seeing a show and instead visit the bookstore. In July, he “looked at books about President Reagan and about presidential assassins,” Assistant U.S. Attorney Sarah Chasson said last month.

He later raved about the film “Captain America,” which he had not seen.

Clickner was the first witness to testify on behalf of prosecutors in their case. Several doctors, therapists and Hinckley’s sister and brother testified in November and December on behalf of the hospital’s proposal.

Read more: The Post’s criminal justice coverage