NEW YORK (AP) — A man accused of attacking police with a machete near New York’s Times Square on New Year’s Eve was arrested on charges of attempting to murder officers, police said Monday as authorities continue to investigate whether he was motivated by Islamic extremism.

Trevor Bickford, 19, also faces attempted assault charges from the attack that injured two officers at the edge of the high-security zone where throngs of new year’s revelers were gathered, the New York Police Department said in a release.

Bickford, who lives in Wells, Maine, remained hospitalized Monday with a gunshot wound to the shoulder from police fire during the confrontation. He was awaiting arraignment, and it wasn’t immediately clear whether he had a lawyer who could speak to the allegations. The Associated Press left messages for his relatives.

A law enforcement official familiar with the matter told The AP on Sunday that investigators believe Bickford traveled to New York City earlier in the week. They are examining whether he made the trip specifically to attack police at the Times Square festivities, the official said.

New York City police and federal officials are still trying to ascertain a motive, and investigators are reviewing Bickford’s online postings, which included some mentions of Islamic extremist views, the official said. The official could not publicly discuss details about the ongoing investigation and spoke to The AP on condition of anonymity.

Michael Driscoll, the assistant director in charge of the FBI’s New York field office, said Sunday that investigators believe the attacker acted alone.

The attack happened about two hours before midnight on Saturday, just outside the area where people are screened for weapons before gaining entry to one of the world’s biggest and most famous New Year’s celebrations.

Two of the officers were struck with the machete before an officer shot the suspect, authorities said. One officer suffered a fractured skull and the other has a bad cut; both were expected to recover. So was the suspect.

The violent attack briefly sent some people running, but the festivities in Times Square continued.

___

Associated Press writers Eric Tucker in Washington, Michael Balsamo in Kansas City, Missouri, and Michael R. Sisak in New York contributed to this report.