The two sons of deposed Egyptian President Hosni Mubarak were released from prison nearly four years after they were first arrested along with their father, authorities say.

Security officials said the two, businessman Alaa and Mubarak's one-time heir apparent Gamal, walked free from Torah Prison in a southern Cairo suburb on Monday and headed to their respective homes in the capital's Heliopolis suburb.

The two, along with their father, still face a retrial on corruption charges.

Separately, the two sons also face trial on insider trading charges. They had been acquitted of other charges.

Mubarak, now 86, stepped down in February 2011 in the face of a popular uprising. He and his two sons were arrested in April that year. Mubarak remains held at a military hospital in a southern suburb of Cairo.

The security officials spoke on condition of anonymity as they weren't authorised to speak to journalists.

The release of the two had been expected for several days.

However, it came a day after deadly clashes between anti-government protesters and police marked the fourth anniversary of the uprising that ended Mubarak's 29-year rule.

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

The release of Mubarak's sons could prompt further demonstrations.

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.