Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A police officer with the Washington, D.C. Metro transit system has been charged with providing support to ISIS, the first time a law enforcement officer has been accused of aiding the terror group, authorities said Wednesday.

Nicholas Young, 36, was arrested without incident at the transit agency's Washington headquarters and is due in court later today, law enforcement officials said.

Young is accused of purchasing 22 gift cards for mobile messaging apps to aid ISIS overseas, court records say. The FBI used an undercover informant to catch him.

He posed no credible threat to the Metro system, said Joshua Stueve, spokesman for the U.S. Attorney's office in Virginia's Eastern District. He was focused on aiding ISIS overseas, court documents say — not on an attack at home.

According to court records, he had been under scrutiny since as far back as 2009, when Metro officials reported suspicious behavior to the FBI.

Virginia Man Arrested for Attempting to Support ISIL https://t.co/DVWzRXBs6q — Justice Department (@TheJusticeDept) August 3, 2016

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Officials say he was under nearly constant surveillance, which is why they were confident he couldn't use his job to pose a threat.

Court records say he had Nazi sympathies and was a longtime supporter of Islamic extremism. He traveled to Libya in 2011, telling the FBI he fought with rebels seeking to oust dictator Moammar Gadhafi.

Related: U.S. Begins New Airstrike Campaign Against ISIS Targets in Libya

According to a criminal affidavit, Young met on 20 separate occasions with an FBI source posing as an ISIS fighter. Young advised the source on how to evade law enforcement detection, the document says.

Passengers ride a Washington Metro subway train at the Chinatown Metro Station in Washington. Pablo Martinez Monsivais / AP

Young faces a maximum of 20 years in prison if convicted.

Court records do not accuse Young of working with others. But they say he was acquainted with two Washington area residents who have subsequently been convicted in terrorism cases.

The documents say Young knew Zachary Chesser, convicted in 2010 of providing support to al Qaeda's affiliate in Somalia.

They also say he met with Amine El Khalifi, the year before he pleaded guilty to plotting a suicide bomb attack on the US Capitol. Khalifi was sentenced to 30 years in prison.

Related: New Counterterrorism 'Heat Map' Shows ISIS Branches Spreading Worldwide

The case against Young is an example of the dilemmas confronting the FBI and other agencies as they hunt for ISIS domestic plots.

Officials admit he wasn't plotting an attack at home, and there would be no case against him at all had authorities not used an undercover informant who, according to court records, discussed an "obligation" to fight with ISIS.

Still, had the FBI not done that, and had Young become involved in violence, authorities would have come under hard questioning about all their interactions with him for years — including surveillance and multiple FBI interviews.

The Young case also shows the extent to which sympathies for violent organizations have spread into the far corners of society, including to a law enforcement agency in the nation's capital.