A Yemeni national, who investigators said once helped a Long Island man join al-Qaida, pleaded guilty Tuesday in federal court to charges he conspired to kill American soldiers in Afghanistan and other terrorism charges, officials said.

During an appearance in federal court in Brooklyn, Ali Alvi al Hamidi admitted that in 2008 he traveled to Pakistan for combat training with al-Qaida to enable him to fight with Taliban forces against American troops in Afghanistan, Assistant Attorney General John P. Carlin said in a statement.

Investigators said that al Hamidi, 31, who has been identified in court papers as “Ali Alvi,” received training in weapons and explosives, although prosecutors didn’t allege that his actions actually killed or injured any American soldiers.

Al Hamidi also helped American citizen Bryant Neal Vinas, formerly of Patchogue, to join al-Qaida and travel to Pakistan. After receiving training from al-Qaida and taking part in two rocket attacks on American forces in Afghanistan, Vinas plotted with the terror group to carry out an attack on the Long Island Rail Road at Penn Station. He was arrested by Pakistani authorities before he could carry out his plan and eventually was turned over to the FBI. Officials said al Hamidi’s guilty plea covers the help he gave to Vinas.

advertisement | advertise on newsday

Vinas pleaded guilty to federal terrorism charges in 2009, including charges of conspiracy to kill Americans and giving material support to a terrorist organization. Vinas has been a cooperating witness in terrorism cases in the United States and abroad. Court records indicate he also gave the FBI information that led to al Hamidi’s arrest. Vinas is awaiting sentencing and is believed to be in the federal witness security program.

Al Hamidi will be sentenced by Judge Nicholas Garaufis and faces a maximum sentence of life in prison. Defense attorney Stuart Grossman couldn’t be reached for comment.