KANSAS CITY, Kan. — A 20-year-old Topeka man was arrested and charged on Friday with plotting to detonate a suicide car bomb on the military base at Fort Riley, Kan.

The man, John T. Booker Jr., whose enlistment in the Army last year was denied after he posted on Facebook that he wanted to wage jihad, told a confidential government informant in December that he wanted to strike the military installation, according to a complaint filed in Federal District Court in Topeka. Mr. Booker then took steps over the next several months to plan the attack, including buying materials to make a bomb, renting a storage locker and filming a video saying he was acting in the name of the Islamic State, the extremist group in Iraq and Syria.

The charges were announced here at the office of the United States attorney for the District of Kansas, Barry R. Grissom. Eric K. Jackson, the special agent in charge of the F.B.I.’s local office, joined him at a news conference.

“Over a period of months, he began doing and taking actions that were more than just mere talking,” Mr. Grissom said, adding that Mr. Booker’s arrest “reminds us that we in law enforcement have to remain vigilant.”