York County sheriff’s deputies charged two men with terrorizing in connection with a Feb. 10 bomb threat at the York County Courthouse.

Deputies charged Bert Stroud, 27, of Saco, and Gilbert Perez, 30, of Acton, in connection with the threat that led to the evacuation of the building and cancellation of court that day.

Chief Deputy William King said Stroud called in the bomb threat in exchange for heroin from Perez. Perez orchestrated the crime because he was due to be sentenced for an assault in Lebanon.

Now Perez, who would have been released this month, faces up to five years in prison and a fine of up to $5,000. Stroud faces the same penalties.

Sheriff’s investigators worked with judicial marshals and Maine State Police to track down the owner of the cellphone that was used to make the threat.

The cost of the threat in terms of emergency responders and lost work time was estimated at more than $25,000, King said.

The defendants could be required to pay restitution.

The arrests were announced on the steps of the 208-year-old York County Courthouse in Alfred, one of the oldest courthouses in the state.