A Maine man who admitted trying to kill three police officers with a machete in a terrorist attack near New York’s Times Square on New Year’s Eve 16 months ago was sentenced to 27 years in prison on Thursday in a courtroom packed with officers.

The sentencing of Trevor Bickford in Manhattan federal court came after Judge P. Kevin Castel listened to emotional statements from the three police officers who Bickford attacked about two hours before midnight on Dec. 21, 2022, as the officers screened New Year's revelers at the sole entrance to an otherwise closed-off Times Square.

MAINE 'JIHADIST' PLEADS GUILTY TO NEW YEAR'S EVE 2022 MACHETE ATTACK NEAR TIMES SQUARE

Bickford shouted "Allahu akbar" — the Arabic phrase for "God is great" — before striking the officers in the head with the machete and trying to grab an officer’s gun. One officer suffered a fractured skull.

A machete which was used to wound 3 NY police officers in an attack at Times Square in New York on January 01, 2023. 

A machete which was used to wound 3 NY police officers in an attack at Times Square in New York on January 01, 2023.  (NYPD/Anadolu Agency via Getty Images)

The threat ended when Officer Michael Hanna shot Bickford in the shoulder. At a hospital, Bickford told authorities that he had studied radical Islamic ideology and decided to wage jihad against U.S. officials.

The judge cited the 20-year-old Bickford’s age and history of mental illness as reasons for leniency from federal sentencing guidelines that recommended a life term. Prosecutors had requested a 50-year sentence while the defense recommended a 10-year term.

He also recounted how Bickford's mother had repeatedly sought help from police and hospitals as she saw her son's descent into mental illnesses that have been diagnosed to include schizoaffective bipolar disorder and major depression syndrome with symptoms of depression, mania and psychosis, including grandiosity and hallucinations.

The judge said Bickford told mental health professionals 20 days before the New Year's Eve attack that he had a plan for harming others, intended to act on the plan and wanted to commit a jihadist attack.

"I’m not a medical person, not here to judge the medical people who saw this and met with him, but it’s disturbing to read these records," Castel said. "If his mother was listened to, her instincts were listened to, if the medical profession could look at things a little differently, this might not have happened."

Given a chance to speak, Bickford apologized to the officers he harmed and other witnesses to his crime.

"I understand that I left scars, physical and mental," he said. "My mental illness took me down a dark path."

Hanna, the first officer to speak at the sentencing, recalled the attack, saying he had just ducked his head slightly when he "saw a large blade swiping next to my head" and spun around to see Bickford chasing him with a machete that contained a 13-inch blade.

"As he continued to approach, I took my firearm out and discharged one bullet, which immediately struck the defendant. He dropped to the ground," Hanna said.

The officer said his parents had immigrated from the Middle East two decades ago "to escape this type of thing."

Officer Louis Lorio said he could barely remain conscious after a large cut to his scalp required seven stitches that night.

Now, he said, he suffers migraine headaches several days a week and is likely to be forced into retirement after a decade-long police career as he copes with anxiety and depression that cause him to "burst out crying for no reason" or cripple him with waves of sadness. Therapy, though, has helped, he added.

Officer Paul Cozzolino, who had graduated from the police academy only a day before the attack, said some physical pain such as headaches will last forever. He choked up as he said the part he will "cherish forever" was when he went home to his family that night.

Defense attorney Marisa Cabrera said her client, who is "deeply remorseful," comes from a family with a "strong and proud military background," including two grandparents who served in the U.S. Navy, a brother currently in the military and a younger brother who plans to join.

Bickford wanted to join the military too before psychological illnesses took over, she said.

Now, she said, "Bickford has returned to his old self with the aid of medication and treatment."

CLICK HERE TO GET THE FOX NEWS APP

Assistant U.S. Attorney Kaylan Lasky, though, urged the judge to ignore Bickford's "self-serving claims" of rehabilitation, particularly because he could return to his former state of mind if he ever went off his medication.

She said he "should not be given another opportunity to kill Americans" after he "injured, maimed and terrorized innocent New Yorkers."

The judge ordered that after Bickford gets out of prison, authorities monitor his internet usage and other facets of his existence for the rest of his life.