CAIRO — Egyptian prosecutors on Wednesday released on bail an opposition leader widely expected to run against President Abdel-Fattah el-Sissi in next year’s elections, but they referred him to trial over the highly unusual charge of offending public morals for allegedly making an obscene finger gesture.

Amnesty International called on Egyptian authorities to drop the “absurd” charge against Khaled Ali, saying his arrest and prosecution were politically motivated.

“The presidential elections are not scheduled to take place until 2018, yet the Egyptian authorities seem intent on pre-emptively crushing any potential rivals to maintain their grip on power,” Najia Bounaim of the London-based advocacy group said in a statement.

Ali was summoned by prosecutors on Tuesday for questioning in connection with the alleged incident on the street outside a Nile-side courthouse in January when he and other lawyers had just won a milestone case against the government, blocking its agreement to surrender to Saudi Arabia control of two strategic Red Sea islands.

The prosecutors ordered him detained for 24 hours after he refused to answer questions before reviewing the evidence brought against him, including a video clip of the alleged incident. He spent the night at a police station and was brought back to the prosecutors’ office on Wednesday but was not questioned.

Instead, the prosecutors released him on bail, set at 1,000 Egyptian pounds ($55), and referred him to trial, which starts May 29. If convicted, Ali could face up to six months in prison or a fine, according to lawyers familiar with the case. More seriously, a conviction could render him ineligible to run for Egypt’s highest office.

Although the gesture in question is perceived as vulgar, arresting — let alone putting on trial — anyone for doing so is unheard of in Egypt. Ali’s supporters have sought to underline this point, posting on social media photos of senior Egyptian policemen and soldiers making the exact same obscene gesture at protesters several years ago.

“I am very surprised. They could have gotten him on a variety of other charges, but this?” said Taher Abo el-Nasr, one of at least 60 lawyers who waited for Ali to arrive at the prosecutors’ office on Wednesday. He was kept inside a cell for several hours before he was taken back to the police station from which he was later released.

“We will have to see the sequence of the gesture on the video clip, which was most likely made inadvertently,” Abo el-Nasr told The Associated Press.

Ali unsuccessfully contested presidential elections in 2012. He did not run in the 2014 elections which el-Sissi, a general-turned-president, won a year after he led the military’s ouster of an Islamist president. He told the AP in February he was considering running next year. There have since been a series of consultations among liberal and pro-democracy parties on finding a consensus candidate, with Ali a clear front-runner.

Ali did not speak to reporters after his release, but was greeted by a small crowd of supporters who chanted his name. “Bread, freedom and the islands are Egyptian,” they chanted, playing on the main slogan of the 2011 uprising that toppled autocrat Hosni Mubarak __ “Bread, Freedom and social justice.”

Ali’s detention follows the arrest in recent days of scores of young activists across much of Egypt, mostly for what authorities label “internet crimes.” They included young activists rallying support for Ali’s possible candidacy or for Bread and Freedom, the party he has founded.

Ali is a key figure among a small core of mostly young secular activists. His candidacy would be a long shot, but he sees it as a way to breathe life into Egypt’s leftist, liberal and pro-democratic forces after years of disarray in the midst of a government crackdown overseen by el-Sissi.

He could count on the votes of many of the millions of young men and women who rose up against Mubarak in 2011 but who are now vilified by pro-government media as foreign agents and saboteurs. He could also draw “protest” votes from among the millions of poor and middle-class Egyptians crushed by a steep rise in food prices and services caused by the introduction of economic reforms deemed key to salvaging the economy.