LOS ANGELES -- A California man who used the Internet and Facebook to connect with al-Quaida pleaded guilty Friday to a federal terrorism charge after admitting he attempted to assist al-Qaida by providing weapons training, the U.S. attorney's office said.

Sinh Vinh Ngo Nguyen, 24, of Garden Grove, unexpectedly entered the plea before U.S. District Judge John F. Walter, who scheduled sentencing for March 21, prosecutors said in a statement. Reporters were not notified of his court appearance and were not present.

Nguyen faces a maximum of 15 years in federal prison.

The judge who accepted the plea previously had expressed skepticism about whether Nguyen had any special skills to offer al-Qaida.

Nguyen had confessed to federal agents after he was unmasked by an undercover FBI agent posing as a recruiter for the terrorist group.

He said that he planned to offer himself as a trainer of some 30 al-Qaida forces to ambush troops in Syria, where he had already spent five months fighting with rebels, assistant U.S. attorney Judith Heinz said after his arrest in October. She said he underwent 50 hours of interrogation during which he confessed to his plan.

Nguyen's admission was contained in a plea agreement filed in federal court, according to a U.S. attorney's news release issued after the plea was entered and accepted.

"Nguyen admitted that approximately one year ago he traveled to Syria where he joined opposition forces," the statement said. "Using a social network site during a four-month period he was in Syria, Nguyen told people that he was fighting against the Assad regime and that he had had a 'confirmed kill.' "