A former U.S. Customs and Border Protection watch commander at the Los Angeles and Long Beach ports pleaded guilty Wednesday to federal criminal charges for running an illegal gun-selling business.

Wei Xu, 56, of Santa Fe Springs, pleaded guilty to four felonies: unlawfully engaging in the business of dealing in firearms, unlawfully possessing unregistered firearms, making materially false statements to a federal agency, and tax evasion, according to the U.S. Attorney’s Office.

Authorities said Wu had more than 40 machine guns and other illegal firearms. They said he also failed to disclose his foreign financial interests and contacts in China in order to obtain a secret-level security clearance.

U.S. District Judge R. Gary Klausner scheduled a Jan. 14 sentencing hearing in downtown Los Angeles. Xu, who face up to 25 years in federal prison, has been in custody since his arrest on Feb. 5.

Xu admitted in his plea agreement and in open court that he sold at least 99 firearms without the required federal license between the late 1990s and his arrest. To increase the profit margin of his unlawful firearms-selling business, Xu exploited his status as a law enforcement officer to purchase and then transfer “off-roster” handguns that cannot be sold to the general public, according to the plea agreement.

Xu also sold or transferred firearms within days or weeks from the date he purchased them and operated several accounts on Internet marketplaces to advertise his firearm business, according to court documents.

In July and August 2018, Xu sold four firearms to an undercover agent posing as a buyer, and unlawfully sold three of the firearms out of the trunk of his car, according to his plea agreement.

The firearms included an “off-roster” pistol, high-capacity magazines, and a short-barreled rifle, the plea agreement states. A search of Xu’s home recovered more than 250 firearms, including 41 fully-automatic firearms or machine guns and two additional short-barreled rifles—none of which were registered with the Bureau of Alcohol, Tobacco, Firearms and Explosives as required by federal law, according to prosecutors.

Xu also admitted that he lied on three questionnaires submitted to the Office of Personnel Management to obtain a secret-level security clearance. OPM is a federal agency that oversees applications for security clearances for federal government employees.

Finally, Xu admitted in his plea agreement that he willfully evaded the payment of federal income tax from 2005 to 2017 by setting up Trans Pacific Group Inc., a Florida-incorporated sham company used to claim fictional business losses to offset his income and fraudulently evade taxes, according to the U.S. Attorney’sOffice.

“Mr. Xu’s public life as a federal officer masked his private greed and disrespect for the law, which he demonstrated through illegal weapons sales, tax evasion, and lying about contacts with foreign nationals,” said U.S. Attorney Nick Hanna. “Public officials promise to act with integrity when they take an oath of office, and we will zealously prosecute those who mock the laws they have sworn to uphold.”