CAIRO — Sudan's President Omar al-Bashir on Wednesday rejected calls for him to step down as hundreds of citizens took to the streets in Khartoum's twin city of Omdurman in a march to Parliament to deliver a note demanding that the longtime ruler resign.

Al-Bashir told a gathering of several thousand supporters in the capital Khartoum that he is ready to step down only "through election."

The developments were the latest in three weeks of anti-government demonstrations that have engulfed Sudan and left up to 40 people dead and hundreds detained.

There "are those who conspire against Sudan and seek to attack it. There are no other options but national dialogue and elections," al-Bashir said in televised comments as supporters chanted "there is no alternative to al-Bashir."

"The decision is the decision of the Sudanese people through the ballot box," added al-Bashir, who then briefly danced on the stage and waved with his cane in the Green Yard, an open area in the city.

Also at the rally, al-Bashir — in power since he led an Islamist-backed military coup in 1989 — advised opposition parties to prepare for elections in 2020. His supporters arrived in packed buses for what was the largest rally in Khartoum in support of the president since the protests erupted.

On Tuesday, during a visit to a military base in the railway city of Atbara, al-Bashir blamed violence during anti-government protests on conspirators, the state SUNA news agency quoted him as saying — conspirators who "planted traitors among us."

Atbara is a traditional bastion of dissent and one of several cities where anti-government demonstrations began Dec. 19, initially over rising prices and shortages but which quickly shifted to calls for al-Bashir to step down.

As al-Bashir spoke at the Khartoum rally, hundreds of protesters in Omdurman chanted, "revolution is the people's choice" and "freedom, dignity and justice."

Video clips purported to show crowds of several hundred each gathering on side roads and headed toward Parliament. Police used tear gas and fired in the air to disperse them before they could deliver their note. There were no reports of casualties.

Sudan's Parliament is packed with al-Bashir's loyalists, who are campaigning to amend the constitution to allow the general-turned-president, already one of the longest serving leaders in the region, to run for a new term in 2020 elections.

SUNA reported in August that the country's ruling party has nominated al-Bashir for re-election in 2020.

In Wednesday's address, in which he frequently quoted verses from the Quran, al-Bashir, who is an Islamist, again blamed the country's economic woes on international sanctions and enemies of Sudan who don't want it to progress.

"They imposed an economic blockade ... to make Sudan kneel and Sudan will only kneel to God," he told his supporters without elaborating.

Sudan's economy has stagnated for most of al-Bashir's rule. He has also failed to unite or keep the peace in the religiously and ethnically diverse nation, losing three quarters of Sudan's oil wealth when the mainly animist and Christian south seceded in 2011 following a referendum.

Critics say rampant corruption is eating up a significant part of government funds and engineering shortages of basic items to manipulate prices. The protesters have been chanting against the "government of thieves."

Authorities have said that 19 people died in the three weeks of protests, while Human Rights Watch said Tuesday at least 40 people have been killed since the protests erupted. Sudan's Interior Minister Ahmed Bilal Othman told lawmakers on Tuesday that police have arrested 816 people.

The United States, Britain, Norway and Canada said late Tuesday that they are "appalled by reports of deaths and serious injury to those exercising their legitimate right to protest, as well as reports of the use of live ammunition against protesters."

In a joint statement, the four countries urged Sudan authorities to release all journalists, political opposition leaders, human rights activists, and other protesters currently in detention without charge or trial.