CAIRO: Two sons of ousted Egyptian president Hosni Mubarak have been released from prison, nearly four years after they were first arrested along with their father, security officials have said.

The officials said the pair - wealthy businessman Alaa and Mubarak's one-time heir-apparent Gamal - walked free from Torah Prison in a suburb of southern Cairo shortly after daybreak today and were believed to have headed to their respective homes in the capital.

The two men, along with their father, still face a retrial on corruption charges and separately face trial over insider trading. They had been acquitted of other charges.

Mubarak stepped down in February 2011 in the face of a popular uprising. He and his two sons were arrested in April that year.

The release of the two had been expected since a Cairo court ordered their release on bail on Thursday.

The Mubarak sons were sentenced to four years in prison on charges of using state funds to renovate family residencies. Their father got three years in the case. The sentences were overturned earlier this month.

Mubarak was sentenced to life in prison in 2012 for failing to prevent the killing of some 900 protesters during the 18-day uprising against his rule. That verdict also was overturned on appeal. He was retried but the case was dismissed last month on a technicality.

Mubarak's sons walked free a day after deadly clashes between anti-government protesters and police marked the fourth anniversary of the uprising that ended their father's 29-year rule.

That violence on Sunday left at least 18 people dead, including two men authorities said died planting a bomb and three police officers, and wounded dozens.

The two, particularly Gamal, are viewed by many Egyptians as among the pillars of an authoritarian and corrupt administration that struck an alliance with mega-wealthy businessmen at the expense of the nation's poor and disadvantaged.

Mubarak was widely believed to have been grooming Gamal to succeed him. The two consistently denied that, but the perceived succession plan - along with corruption, police brutality and poverty - were among the main causes of the 2011 uprising.

The release of the two sons could spark further protests and would certainly fuel the notion among the secular and liberal activists behind the 2011 uprising that the Mubarak regime has been making a comeback since President Abdel-Fattah el-Sissi, a general-turned-politician, took office in June.

The shooting deaths of two female protesters over the weekend have stoked renewed anger over the police's use of excessive force and created an uproar among rights activists.

The death of one of the two, a 32-year-old mother of a small boy, was captured on several videos that, activists and witnesses claim, point to the police as the perpetrators. Authorities say they are investigating the incident.