Authorities have alleged that Shifler anonymously targeted 25 people and institutions with hateful threats, insults and false crime reports from March 2004 to February 2006.
An FBI agent wrote in an affidavit that Shifler sent "insulting and abusive" letters to Hagerstown Police Department members after the department fired him in 2003 for falsifying payroll records.
Shifler was fired from the Boonsboro Police Department this year.
Wearing a gray T-shirt and blue jeans Tuesday, Shifler said "yes" or "no" to District Judge J. Frederick Motz's questions about the plea agreement.
"Did you do the things that the government says you did?" Motz asked.
"Yes," Shifler replied.
After pleading guilty to the two counts, Shifler briefly turned and waved to family members. He was then handcuffed and led away.
Motz has said Shifler is being detained in Allegany County, Md.
The first count was intimidating and interfering with African-American students at North Hagerstown and South Hagerstown high schools by making a phone threat to the Washington County Board of Education on Nov. 29, 2005.
A statements of facts quotes Shifler as saying: "We have two guns at North High. We have two guns at South High. We're going to blow the n-----s away."
Both schools were locked down.
Shifler called from a pay phone at the Burger King on Maugans Avenue, the statement of facts says.
He also pleaded guilty to threatening to burn Hagerstown Councilwoman Alesia D. Parson-McBean's home.
The statement of facts says Shifler left as a voice-mail message: "Hi, Alesia. Please talk to us soon. We're the KKK. We're about to take you down and burn your house. The end is near, n----r, so get prepared. We'll see you soon. Bye-bye."
The prosecution filed those charges July 17. They replaced three other charges: one count apiece of making threats by phone, making threats by mail and falsely claiming he had placed anthrax at Hagerstown City Hall.
Parson-McBean watched Tuesday's proceedings, but declined to comment afterward.
A man who watched with her said they were "too traumatized" to talk. He said "healing the community" is a priority.
Members of Shifler's family also declined to comment.
"Mr. Shifler accepted responsibility for his conduct and deeply regrets any harm he may have caused to any victims," Balter said outside the courthouse.
Anthony Trotta, Washington County Public Schools' chief legal counsel, said the U.S. Attorney's Office sent the school system a letter advising them of the plea agreement and Tuesday's proceedings.
"We'll make sure we contact the U.S. Attorney's Office and see what assistance we could provide," Trotta said.
Motz said in court that the defense and prosecution disagree on a few sentencing factors. Balter declined to elaborate afterward.
Marcia Murphy, a spokeswoman for U.S. Attorney for the District of Maryland Rod J. Rosenstein, said there is no mandatory minimum sentence.
Staff writer Erin Cunningham contributed to this story.