A group of soldiers attempted a coup, announcing on state TV that they had seized power.
Gunfire was reported near the presidential residence as mutineers took over the state broadcaster.
Loyalist forces quickly moved in and regained control of key installations.
Several soldiers involved in the mutiny were arrested, and the president was confirmed safe.
ECOWAS and the African Union condemned the attempted coup and called for constitutional order.