A Minnesota man accused of threatening to kill a federal judge and FBI agents has pleaded guilty to a lesser count.

Nineteen-year-old Khaalid Adam Abdulkadir admitted Tuesday to a misdemeanor of impeding a federal officer or employee. He says he's sorry for everything he did wrong.

Prosecutors say he made the threats over Twitter in December after his friend was arrested for conspiring to support the Islamic State group.

As part of his plea agreement, Abdulkadir was sentenced to three years of probation, including two years of electronic monitoring.

He had been scheduled to stand trial Tuesday on charges that included threatening to murder a federal judge and a federal law enforcement officer.

Court documents say he posted one tweet that included the words "kill them FBI."