A defense lawyer challenged the forensic evidence linking alleged al-Qaida recruit Muhanad al Farekh to a 2009 attack on a U.S. base in Afghanistan as the trial of the American terror defendant began Tuesday in Brooklyn federal court.

Al Farekh, 32, of Houston, was a member of al-Qaida’s “external operations” contingent from 2007 to 2014 whose fingerprints were found on adhesive tape wrapping the detonator of an undetonated truck bomb used in the attack, a prosecutor told jurors in opening arguments.

“He built a bomb that he and others used to try to murder Americans,” said prosecutor Saritha Komatireddy, calling al Farekh “an American citizen who turned his back on his country.”

Al Farekh, who was captured by Pakistani police in 2014, sported a dark blue blazer, unbuttoned light-blue collared shirt and khakis in court.

His lawyer, David Ruhnke, said the government’s case was built on forensic evidence — fingerprint and handwriting evidence and mitochondrial DNA — that leaves room for reasonable doubt.

“The issue is not whether it happened,” Ruhnke said. “The real issue is whether Muhanad al Farekh had anything to do with it.”

advertisement | advertise on newsday

Al Farekh, who’s of Jordanian descent, went to Pakistan with two fellow students from the University of Manitoba in Canada.

Prosecutors and the defense said the government would call cooperating witnesses — possibly including two men convicted of plotting to bomb New York subways, Najibullah Zazi and Zarein Ahmedzay — to testify that they saw him in al-Qaida camps.

In the attack on Forward Operating Base Chapman that is at the heart of the case, a two-truck convoy tried to break through the outer perimeter.

The first one detonated to open a path, but the second one — with a larger payload equivalent to the Oklahoma City federal building truck bomb in 1995 — got stuck in the crater and never exploded.

No American soldiers or Afghans other than the drivers were close enough to be killed.