CAIRO — Acting on a judge's order, Egyptian police detained the sons of former president Hosni Mubarak on Saturday along with three others in connection with insider trading charges for which the five are on trial, security officials said.

They said the arrests were ordered by judge Ahmed Aboul-Fetouh before he adjourned the case's hearings until Oct. 20. The Mubarak sons — wealthy businessman Alaa and Mubarak's one-time heir apparent Gamal — were taken to a prison south of Cairo after the hearing, according to the officials, speaking on condition of anonymity because they were not authorized to brief media.

The detention of the two brothers came as something of a surprise given that the trial has been proceeding without incident. It was not immediately clear if their detention has anything to do with a recent warning to Gamal Mubarak by a newspaper editor close to the government to abandon any political ambitions.

The two sons and their father were sentenced to three years in prison following their conviction of embezzling funds set aside for the restoration and maintenance of presidential palaces, using the money to upgrade their private residences. The sons were released in 2015 for time served, while Mubarak walked free last year. The trio paid back to the state the money they embezzled.

The three were first detained in April 2011, two months after a popular uprising forced Mubarak to step down after nearly 30 years in power. After a long trial, Mubarak was acquitted of killing protesters during the 18-day uprising against his autocratic rule.

The ongoing insider trading trial centers on the buying by the two brothers of a large number of shares in a local Egyptian bank that they allegedly knew was to become the target of a takeover by an Arab Gulf investor, a move that was virtually certain to dramatically drive up share prices.

One of the five ordered detained on Saturday is investment banker Hassan Heikal, son of Mohamed Heikal, a confidant of Egypt's late nationalist leader Gamal Abdel-Nasser and the author of a series of books giving insider accounts of Egypt's wars and peacemaking with Israel. He died in 2016.

Preventing Gamal from succeeding his father was among the chief motives for the 2011 uprising and the military's subsequent support for the revolt. The years that followed saw most pillars of Mubarak's regime go on trial on corruption or power abuse charges, but almost all of them have since been acquitted or walked free after repaying part or all the funds they had illegally amassed.

But while most Mubarak regime luminaries have since lived quietly on the sidelines, second-string Mubarak loyalists have found their way back to public life under the rule of general-turned-president Abdel-Fattah el-Sissi, particularly in parliament, a mostly rubber-stamp chamber packed with government supporters, and the media.

However, Gamal Mubarak's frequent public appearances and the relatively warm reception he has received from members of the public have drawn the ire of el-Sissi's supporters.

Yasser Rizq, possibly the closest newspaper editor to el-Sissi, sternly warned Gamal Mubarak in a May article against harboring political ambitions. He suggested that Mubarak's son may have forged an alliance with the outlawed Muslim Brotherhood to run for president when el-Sissi's second, four-year term ends in 2022.

El-Sissi led the military's 2013 ouster of Egypt's first freely elected president — Mohammed Morsi of the Brotherhood — and has since overseen a massive crackdown on his supporters, jailing thousands of them along with secular activists behind the 2011 uprising.

Egypt's constitution prohibits el-Sissi from running for a third term in office, but his supporters have occasionally raised the specter of amending the constitution to allow him to do so or to extend the duration of his term. He won a second term in office this year in an election in which his only opponent was a little-known politician known to be among his staunchest supporters.