An Alberta man has pleaded guilty to sending threatening emails to Prime Minister Justin Trudeau.

William Benham, 52, was in Medicine Hat provincial court Wednesday and entered a guilty plea to charges of uttering threats and threats to cause damage to property.

Benham was arrested on Jan. 12 after he emailed the threats to several officials — including Trudeau and Medicine Hat Mayor Ted Clugston.

The emails included threats against government and specific threats toward the prime minister, although a police investigation determined he had no plans to follow through on those threats.

Benham got a 30-day jail sentence, followed by 24-months probation with numerous conditions.

Those conditions include a prohibition on communicating directly with any of the people he had threatened.

He has also been ordered to abstain from alcohol and drugs, and attend psychiatric counselling.