A New York City man who plotted a terrorist attack with a knife on behalf of the Islamic State terror group pleaded guilty in federal court Friday. 

Awais Chudhary, 22, admitted to attempting to provide material support to ISIS in a Brooklyn courtroom, the Justice Department said. 

He faces up to 20 years in prison. 

Federal prosecutors said Chudhary, who was born in Pakistan, pledged his loyalty to the terror group in August 2019 after watching terrorist propaganda videos online. He began planning a knife or bomb attack on targets in Queens and sought guidance from ISIS supporters, authorities said. 

US LAUNCHES SECOND SET OF STRIKES IN SYRIA AGAINST IRANIAN-BACKED MILITIAS

Islamic State militant holds ISIS flag in a desert setting

A masked Islamic State soldier poses holding the ISIS flag in 2015. A New York City man pleaded guilty Friday to attempting to provide the terror group with material support, the Justice Department said.  (Pictures from History/Universal Images Group via Getty Images)

He surveilled his intended targets and video recorded areas he wanted to attack, prosecutors said. In addition, he also sent a screenshot of a document from an ISIS propaganda magazine that included a diagram of the human body depicting where to stab victims with a knife. 

To commit the attacks, Chudhary ordered a number of items online, including tactical knife, a mask, gloves, and a cellphone chest and head strap to record the attack in an effort to inspire other lone wolves. 

Chudhary allegedly told one undercover agent he wanted to use a knife for the attack "because that’s what he knows," but would be open to learning how to build a bomb if the undercover agent could teach him. That done, he would consider using a bomb at a "mini-bridge over a busy road with many cars," according to the Justice Department.

CLICK HERE TO GET THE FOX NEWS APP