AUGUSTA, Maine — Five of the 21 men charged last year in a prostitution sting pleaded guilty to engaging a prostitute Tuesday at the Capital Judicial Center, according to the Kennebec County district attorney.

Maine Supreme Judicial Court Justice Donald Alexander, acting as a district court judge, ordered Brian McCrea, 55, of Bowdoinham, Trevor Dunn, 46, of China, Darrell Smith, 42, of Old Town, Guy Buck, 64, of Winthrop and James Raber, 72, of Augusta to pay $800 in fines and fees.

Walter Esancy, 54, of Appleton and Patrick Cazemajou, 51, of Camden pleaded guilty to the same charge in November in Waterville District Court, District Attorney Maeghan Maloney said Wednesday.

In a plea agreement with her office, Esancy and Cazemajou were sentenced to 48 hours in the Kennebec County Jail and ordered to pay $800 in fines and fees.

Maloney said that she urged Alexander to send the five men sentenced Tuesday to jail for 48 hours, but he rejected her recommendation.

The operation that led to the arrests was conducted by placing advertisements online and on social media “resulting in the suspects arriving at a predetermined location with the expectation of having a sexual encounter in exchange for U.S. currency with a person the suspects believed was a prostitute,” Chief Deputy Ryan Reardon of the Kennebec County sheriff’s office said in a statement in September, when the joint operation with the Waterville and Augusta police was announced.

Each man charged in the operation faced up to six months in jail and a fine of up to $1,000 and court surcharge of $500.