Senegal's reputation as a bastion of democracy in an unstable region is on the line as protesters clash with police outside the National Assembly.
Inside, lawmakers have passed a contentious bill to extend President Macky Sall's tenure and delay elections after he called off a planned election with just three weeks to go.
Khalifa Sall, a leading opponent and a former mayor of Dakar, who is not related to the president, called the delay a "constitutional coup" and urged people to protest against it. His political coalition has vowed to go to court.
Thierno Alassane Sall, another candidate, also no relation, called it "high treason" and urged his supporters to gather in front of the National Assembly to protest and "remind MPs to stand on the right side of history".
The proposal needed the support of three-fifths (i.e. 99) of the 165 deputies to pass. The ruling Benno Bokk Yakaar coalition, of which President Sall's Alliance for the Republic party is part, has a slight majority in parliament.
There was a heated atmosphere in the chamber, and it was reported that some opposition MPs had been removed by security forces after they tried to block proceedings.
In the end 105 MPs voted for the proposal. A six-month postponement was originally proposed, but a last-minute amendment extended it to 10 months, or 15 December.
Mr Sall reiterated that he was not planning to run for office again. But his critics accuse him of either trying to cling on to power or unfairly influencing whoever succeeds him.
No sooner had he announced the unprecedented postponement than protesters marched across the capital, Dakar, to call for a reversal.
Senegal has long been seen as one of the most stable democracies in West Africa. It is the only country in mainland West Africa that has never had a military coup. It has had three largely peaceful handovers of power and never delayed a presidential election.