A Rockland man pleaded guilty Tuesday to gun charges and illegally importing a synthetic opioid.

Adam Davis, 37, entered the plea in federal court in Portland.

Federal authorities classified the drug that Davis imported from China, U-47700 – also known as “Pink” or “U4” – as a controlled substance on an emergency basis in November 2016.

In January, border agents intercepted a package, destined for Davis’ apartment in Rockland, that was from China and contained U-47700. They made a “controlled delivery” of the package and arrested Davis after he accepted it.

Federal agents said Davis admitted that he knew that the package contained U-47700 and that he ordered it from China.

While searching Davis’s apartment, federal agents found a gun and Davis on Tuesday also pleaded guilty to possessing a firearm while being a user of a controlled substance.

Davis, who will be sentenced at a later date, faces up to 20 years in prison and a fine of up to $1 million.