NEW YORK (AP) — A man accused of attacking police with a machete near New York’s Times Square on New Year’s Eve is now facing federal terrorism charges after he became determined to wage jihad against the U.S. government, authorities announced Tuesday.

Attorney General Merrick Garland said in a statement that Trevor Thomas Bickford was charged with federal crimes in connection with his self-avowed jidad against U.S. government officials and his knife attack on three police officers in Times Square.

Bickford was already charged with attempting to murder police officers, assault and attempted assault in state court in Manhattan. If convicted, he faces a mandatory life sentence.

State prosecutors have said Bickford shouted “Allahu akbar” at about 10 p.m. on New Year’s Eve before striking one officer in the head and attempting to grab another officer’s gun. He was shot in the shoulder by police during the confrontation and was held without bail after he was arraigned by video from a Manhattan hospital.

The Legal Aid Society, a public defender organization representing Bickford, has urged the public “to refrain from drawing hasty conclusions and to respect the privacy of our client’s family.”

Bickford, 19, of Wells, Maine, began studying radical Islamic ideology last summer, authorities said.

They said he decided in November to wage jihad against U.S. officials and officials of other governments he thought to be anti-Muslim.

He was charged with four counts of attempted murder of officers and employees of the U.S. government and people assisting them. Each charge carries a potential penalty of 20 years in prison in event of a conviction. He was expected to appear in federal court at a later date.

A criminal complaint in Manhattan federal court said Bickford told a family member in late November or early December that he wanted to go to Jordan or Afghanistan to be a suicide bomber for his religion, and he told an older brother, a soldier in the U.S. military, in text messages in mid-December that he wanted to go to Afghanistan to join the Taliban.

He booked a ticket to fly to Jordan on Dec. 12 but didn’t board the flight, the complaint said.

A day later, according to the complaint, the FBI conducted a voluntary interview with him in which Bickford said he had bought tickets to fly to New Delhi, India, several weeks earlier, planning to then go on to Afghanistan. There he hoped to “ally” with the Taliban and persuade them to help him fight the oppression of Muslims in Myanmar, formerly Burma, the complaint added.

The complaint said Bickford claimed he didn’t agree with the Taliban’s use of violence against civilians and had no intention of joining al-Qaida.

It said he began reading the Quran in May or June and attending mosques, but he didn’t think the mosques were adequate, so he began following imams on YouTube.

The FBI began investigating Bickford in mid-December based in part on concerns that members of his family expressed about Bickford’s behavior, the complaint said.

It said family members reported that Bickford had recently converted to Islam and begun frequenting mosques in and around Maine and New Hampshire, where Bickford lived with different family members.

They reported that he also began researching the Taliban and expressed interest in traveling to Afghanistan to join the Taliban before buying a crossbow that he planned to bring with him to Afghanistan, the complaint said.

According to the complaint, Bickford ultimately scrapped his November plans to travel overseas and instead decided he’d wage jihad against the U.S. government within the United States as part of his plan to “wage jihad against officials of governments that he believes are anti-Muslim, including the U.S. Government.”

As part of that effort, Bickford traveled from Maine to New York City for the Dec. 31 attack, the complaint said.

After the Times Square attack, Bickford disclosed in a law enforcement interview that he “carried out the attack for the purpose of waging jihad and that Bickford’s mission involved targeting military-aged men who worked for the U.S. Government and killing as many such officials as he could,” the complaint said.

Bickford told law enforcement that he walked around Times Square on Dec. 31 prior to his attack “trying to figure out the right time to kill,” the complaint said. It added that he said he spent a long period of time praying in the vicinity of Times Square before the attack.

“Bickford intended to die in the attack, in an effort to achieve martyrdom,” the complaint said. “Bickford believed his attack was unsuccessful, because he did not kill any officers, and he did not die himself.”