By Kevin Murphy

KANSAS CITY, Mo. (Reuters) - Two men pleaded guilty in federal court on Tuesday to conspiring to blow up public buildings and police vehicles during protests in Ferguson, Missouri, last year, prosecutors said.

Olajuwon Davis, 22, and Brandon Baldwin, 24, admitted to the explosive charges and also pleaded guilty to conspiring to buy firearms for felons, who are barred by law from acquiring them, the U.S. Attorney's Office for the Eastern District of Missouri, said in a statement.

Attorneys for the two men were not immediately available for comment. Details of the plea agreement were not made available in electronic court filings.

The charges carry penalties of five to 20 years in prison. Sentencing is set for Aug. 31.

Davis was a frequent protester in Ferguson, where white police officer Darren Wilson shot and killed unarmed black teenager Michael Brown in a confrontation on Aug. 9. The incident sparked months of protests that raised questions about the role of race in U.S. policing.

Davis met fellow protester Baldwin, who worked at a sporting goods store and said he could use his position there to get firearms, the statement said.

By November, the two were looking to acquire pipe bombs and tried to get them from an undercover informant working for law enforcement. The two were arrested shortly afterward.

The two had plotted to set off explosives to coincide with an announcement on whether a grand jury would indict Wilson, prosecutors said.

The decision not to indict the police officer set off a fresh wave of protests.

"The disruption of this plot, coming as it did on the eve of the expected grand jury announcement, undoubtedly saved lives," U.S. Attorney Richard Callahan said.

(Reporting By Kevin Murphy in Kansas City, Mo.; Editing by Jon Herskovitz and Peter Cooney)