WASHINGTON—Federal agents on Friday arrested a man who they allege planned to carry out a suicide bombing at the U.S. Capitol, part of a sting operation in which undercover agents posing as al Qaeda operatives provided fake explosives.

Amine el Khalifi was arrested as he walked from a parking garage near the Capitol building carrying what the Federal Bureau of Investigation said was a MAC-10 automatic pistol and a bomb vest, both rendered inoperable by agents.

Mr....