John D. Williams appears at Cumberland County Superior Court in Portland on Feb. 28. Williams is accused of fatally shooting Somerset County sheriff's Deputy Eugene Cole in April 2018.

In court on Monday, a state psychologist testified that the man accused of killing a Somerset County sheriff’s deputy last April had no difficulty understanding his Miranda rights.

Sarah Miller, the director of the State Forensic Service, told prosecutors at Cumberland County Superior Court in Portland she wasn’t worried about John D. Williams’ intellectual abilities when he apparently confessed to fatally shooting Cpl. Eugene Cole on April 25, 2018, according to CBS affiliate WGME.

“When Williams is functioning well, as he was at the time of my evaluation, there were no concerns about his comprehension, his appreciation of the Miranda rights,” Miller said.

[Subscribe to our free morning newsletter and get the latest headlines in your inbox]

Monday was the third day of a three-day hearing on whether Williams’ confession should be allowed as evidence at his upcoming trial, picking up where the court left off March 1.

Attorneys for Williams, 30, of Madison claim he only made incriminating statements to police in the case because those who arrested him had previously “ beat and pummeled” him, and because hunger, exhaustion and drug withdrawal symptoms left him weak.

On the first day of the hearing Feb. 28, Glenn Lang of the Maine State Police said he struck Williams in the face “two or three times” because the suspect was refusing to give his hands up to be cuffed at the time of his arrest. But Lang said he didn’t hit Williams after he was handcuffed and never threatened him.

Police allegedly found Williams hiding out in a small cabin in the woods near Norridgewock on April 28, 2018, after a three-day manhunt.

Each of the eight other local, state and federal law enforcement officers who were involved in the arrest and who testified Feb. 28 or March 1 told the court he either didn’t see Williams hit or kicked, or only saw the hits Lang talked about.

“He wasn’t really cooperative in terms of putting his handcuffs on,” Lang said during testimony Feb. 28. “I struck him two or three times to the left side of his head to get him to comply.”

Miller said Monday that Williams told her he felt threatened by police during his interrogation, but didn’t see any threatening behavior when she watched the taped interview, WGME reports.

On the second day of the hearing, March 1, a video was played in court in which Williams reportedly told detectives he killed Cole to avoid arrest, then stole the deputy’s truck and planned to shoot himself.

“I know there’s no happy ending,” he told the detectives after the apparent confession.

[Video of John D. Williams’ disputed murder confession played in court]

Williams’ defense attorney, Verne Paradie, told reporters last month that he hopes to convince the Superior Court that Williams believed that “if he was talkative [to the detectives who later questioned him], they would prevent the other officers from carrying out on the threats they were making.”

“That’s going to be my argument,” Paradie said last month. “Whether the judge buys that or not, I can’t say. Mr. Williams will most likely have a different story, and the judge will have to decide who he believes.”

During video of Williams’ subsequent questioning by detectives at the Waterville Police Department, played in court March 1, he was apparently given food and clean clothing to wear about 15 to 20 minutes into the dialogue.

Williams had been on the run with no food or water for more than three days after Cole’s fatal shooting, and was escorted from the cabin site naked after he defecated in his pants, police have said.

In the video, detectives read Williams his Miranda rights and stopped frequently to make sure he understood what they were saying.

Miller told the court Monday that someone like Williams who was tired and hungry would be susceptible to leading questions, noting that in some instances he seemed to tell detectives what they wanted to hear while at other times gave different answers, according to WGME.

His defense questioned whether Williams could have disregarded the Miranda warning thinking that police wouldn’t give him food and water unless he talked, WGME reports.

Miller said Williams told her the detectives’ Miranda warnings “came in one ear and out the other,” according to WGME. But she said he explained he was smart enough to understand it, but didn’t think about what that would actually mean for him in the long term if he were to waive those rights.

In his taped interview, Williams told the investigators he was trying to get into his stepmother’s house on April 25, 2018, when Cole showed up.

“I didn’t want to get arrested,” he told a detective. “Grabbed my pistol and pointed it at him. Just made that choice.”

[Police officer said he hit accused deputy killer ‘2 or 3 times’ to get handcuffs on]

Williams’ comments to detectives in the video matched the description of events released in an affidavit in support of a search warrant unsealed last July, which said that Cole slipped and Williams shot him before taking the deputy’s truck to leave the scene.

In the video, he told detectives he didn’t know what to do after taking the truck, but reportedly said he didn’t plan to hurt anyone else, saying he planned to shoot himself.

Williams, who has remained silent throughout the previous two days of testimony, spoke briefly in court Monday only to tell the judge he would not testify, according to WGME. He was previously expected to take the stand.

There is no timeline under which the judge must issue a decision other than the trial date.

Williams pleaded not guilty to the charge of murder in June 2018. Cole was the first law enforcement officer killed in the line of duty in Maine in nearly three decades.