The suspect who attacked three New York City police officers with a machete just outside a security checkpoint for New Year’s celebrations in Times Square and expressed militant support for Islam was arrested Monday and faces two counts of attempted murder, police said.

Trevor Bickford, a 19-year-old resident of Wells, Maine, a city nearly 300 miles from Times Square, also faces two counts of attempted assault in the violent attack, police said.

A spokesperson for the Manhattan District Attorney’s Office told NBC News Monday afternoon that it is unclear when he will be prosecuted «based on a number of factors.»

Authorities said Sunday that the attack happened shortly after 10 p.m. at West 52nd Street and 8th Avenue, just outside the high-security checkpoints that celebrants had to pass through. At that press conference, Bickford was only identified as «a 19-year-old male»; Police confirmed his identity on Monday.

The attack began when Bickford approached an officer and tried to hit him over the head with the machete before striking two officers over the head with the blade, Police Commissioner Keechant Sewell said. He was then shot in the shoulder and taken into custody by police, Sewell said.

All three officers were hospitalized, according to Sewell, who said one had a fractured skull and another had a bad cut. They were released from Bellevue Hospital overnight.

NBC New York reported that Paul Cozzolino, Jr. is the officer who suffered the fractured skull and had just graduated from the police academy the day before the attack.

Three law enforcement officials with direct knowledge of the investigation told NBC News Sunday night that authorities were looking into whether the suspect reached for one of the officers’ service weapons during his takedown.

Four law enforcement sources briefed on the investigation said federal agents knew the suspects after interviewing him in mid-December after a relative tipped them off that he had expressed militant support for Islam. Investigators also knew about him because of his social media posts, the four officials said, adding that Bickford has no criminal record.

The sources added that Bickford is believed to have traveled from Wells to lower Manhattan on Thursday primarily via Amtrak. Investigators are also looking into whether Bickford may have stayed at a homeless shelter upon his arrival, the four officials said.

A diary found by investigators contained information about who should inherit his belongings and where he wanted to be buried in case he was killed in the attack, the sources said. He also said he was sorry for disappointing his mother and hoped his siblings would join him in his fight for Islam, they said, adding that his file also contained terrorism-related propaganda and personal writings. Bickford also made pro-jihadist remarks from his hospital bed overnight, according to the sources.

FBI agents were outside Bickford’s Wells home on Sunday, NBC affiliate WCSH of Portland, Maine reported.

neighbours told NBC affiliate WJAR of Providence, Rhode Island they were shocked by the attack.

«I am amazed to think so close to home that someone would want to go all the way to New York and commit the crime,» Bethanne Brunelle told the local media.

«Wells is a very small community and you think, ‘Did this really happen here?'» said neighbor Steve Isles.

Mithil Aggarwal, tom winter, jonathan dienst Y miles miller contributed.