A longtime Lawrence cop accused of using his position as a police officer to get free cocaine from his go-to drug dealer is facing up to 20 years behind bars on a federal extortion charge, officials say.

John R. Desantis Jr., 44, of Methuen — a 16-year veteran of the Lawrence Police Department — was arrested Thursday night after he started extorting a drug dealer he had been buying “small amounts of cocaine” from for almost a year, U.S. Attorney Carmen M. Ortiz announced yesterday.

Desantis, who last worked for the police department in February 2015 and has been on medical leave, had been buying the cocaine from an unnamed drug trafficker “once or twice a week” for the last “10-12 months” without revealing that he was a police officer, Ortiz said.

Then, on the afternoon of May 16, while buying cocaine from the dealer at his family home, authorities say Desantis lured the man inside and “lifted his shirt to reveal a handgun and what appeared to be a police badge on his belt.” After telling the dealer he was a cop, Desantis stole the cocaine the man was going to sell him as well as two other bags of crack cocaine he was planning on selling to someone else, according to court documents.

The dealer, an illegal immigrant from the ?Dominican Republic with two pending arrest warrants, managed to escape the house by “pleading with Desantis that he was late in picking up his child,” according to court documents.

Two days later, the dealer alerted an FBI agent to the extortion plot and even provided investigators with personal checks he said Desantis used to buy the drugs, court documents say.

In the weeks that followed, Ortiz said Desantis continued to communicate with the drug trafficker by text message and at one point told him: “you will not be arrested at all if you do as I tell you to.”

Lawrence Mayor Daniel Rivera issued a statement yesterday about Desantis’ arrest.

“While we hope that Mr. Desantis gets the help he needs, his arrest continues our effort to increase the credibility and professionalism of the Lawrence Police Department,” ?Rivera’s statement read. “It is important to remember that the unfortunate ?actions of one officer should not overshadow the stellar things that our ?police department does as a whole.”

Desantis faces a maximum sentence of 20 years in prison, three years of supervised release and a fine of $250,000, according to the announcement. He has been detained pending a May 31 detention hearing.