Exclusive

Nicki Minaj's husband's past is coming back to bite him in the ass -- he's been arrested by U.S. Marshals on an indictment for failing to register as a sex offender ... TMZ has learned.

Kenneth Petty was in federal custody Wednesday -- we're told he turned himself into the Marshals. According to court docs, he'll face a judge later today. Petty moved to California in July 2019, but according to law enforcement he got pulled over in Beverly Hills in November and that's when his legal troubles started.

We're told Bev Hills PD made a traffic stop on November 15 and determined Petty was a registered sex offender in New York state but had not registered in California ... as required.

He was arrested and released on a $20,000 bond. The L.A. County D.A. charged him for failing to register as a sex offender.

It appears he still didn't check in after that because now the feds are in on the case. He was indicted in federal court for the same thing ... failing to register.

As we've reported, Kenneth's rap sheet includes a 1995 conviction for first-degree attempted rape. He served almost 4 years in NY state prison for the crime and was required to register as a sex offender. If convicted on the federal charge for failure to register, Kenneth faces up to 10 years in prison.

TMZ broke the story ... Nicki and Kenneth hit up the Bev Hills Courthouse to get a marriage license in July ... around the time the couple moved to Cali.

We've reached out to Nicki's camp for comment, so far no word back.