Global Affairs Canada is warning Canadians to avoid all travel to Sudan after the country's longtime leader was ousted in a military coup.

The military arrested Omar al-Bashir on Thursday following months of protests and unrest, and ordered a state of emergency.

The declaration means security forces can search any building, put restrictions on movements and travel, or arrest anyone based on a suspicion of criminal activity.

An updated travel advisory from Global Affairs Canada released after the coup d'etat notes that protests are intensifying in Sudan and the security situation could deteriorate quickly.

Canadians in the country are being told to minimize their movements and avoid protests and demonstrations, which civil activists have vowed to continue.

Those caught up in the protests should shelter in place until it is safe to leave, have an emergency supply of water and food, and make sure travel documents are in order, Global Affairs Canada says in the advisory.

Sudan's military ousted Thursday, ending his 30 years in power in response to escalating popular protests. The defence minister announced military rule for two years, imposing an emergency clampdown that risks enflaming protesters who have demanded civilian democratic change.

Al-Bashir's fall came just over a week after similar protests in Algeria forced the resignation of that North African nation's long-ruling, military-backed president, Abdelaziz Bouteflika. Together, they represent a second generation of street protests eight years after the Arab Spring uprisings that ousted a number of long entrenched leaders around the Middle East.

But like those popular movements of 2011, the new protests face a similar dynamic -- a struggle over the aftermath of the leader's removal.

After the military's announcement Thursday, protest organizers vowed to continue their rallies until a civilian transitional government is formed. Tens of thousands of protesters were massed Thursday at a sit-in they have been holding outside the military's General Command headquarters in Khartoum.

The military's coup Thursday brought an end to a president who came to power in a coup of his own in 1989, backed by the military and Islamist hard-liners, and who had survived multiple blows that could have brought him down.

Over his three decades in power, al-Bashir was forced to allow the secession of South Sudan after years of war, a huge blow to the north's economy. He became notorious for a brutal crackdown on insurgents in the western Darfur region that made him an international pariah, wanted by the International Criminal Court for war crimes. The United States targeted his government repeatedly with sanctions and airstrikes for his support of Islamic militant groups.

Throughout, he maintained his swagger, famed for his on-stage appearances dancing with his cane before cheering crowds.

The protests that erupted in December have been the biggest challenge to his rule. They were initially fueled by anger over the deteriorating economy but quickly turned to demands for his ouster. They gained new momentum last week after Bouteflika's resignation.

Word of al-Bashir's removal first emerged in the morning. State TV announced that the military would make an "important statement" imminently and the nation should "wait for it." Two officials high in the military and government told the Associated Press that al-Bashir had been ousted.

Thousands of protesters marched toward the centre of the capital Khartoum on Thursday, cheering, singing and dancing in celebration.

The announcement finally came hours later in the afternoon when Defence Minister Awad Mohammed Ibn Ouf appeared on state TV in military fatigues. He said the military had arrested al-Bashir.

"I the defence minister, the head of the Supreme Security Committee, announce the uprooting this regime, seizing its head, after detaining him in a safe place," he said. He denounced al-Bashir's government, saying the military and security agencies had long been observing its "bad administration, systemic corruption, absence of justice, the blocked horizon for all people especially the youth. The poor became poorer and the rich became richer. Hope in equality has been lost."

He also said al-Bashir's heavy-handed security crackdown against protesters had risked cracking the security establilshment.

Ibn Ouf said a military council decided on by the army, intelligence agencies and security apparatus will rule for two years, after which "free and fair elections" will take place.

He also announced that the military also suspended the constitution, dissolved the government, declared a state of emergency for three months, closed the country's borders and airspace and imposed a night curfew for one month.

Protest organizers have feared the military would impose its control after removing al-Bashir. Earlier in the day, one main organizer, the Sudanese Professionals Association, urged protesters to remain in the streets to press for a civilian transitional government.

"We are not leaving. We urge the revolutionaries not to leave the sit-in," the association said, warning against attempts to "reproduce the old regime."

Sarah Abdel-Jaleel, a spokeswoman for the association, told The Associated Press they will not accept a military coup and insist on an "unconditional stepping down of al-Bashir and his regime."