When Mady Abou Elela and some colleagues tried to organize what they billed as a moderate Islamic political party three years ago, the Egyptian government responded decisively. It jailed Abou Elela and 12 associates for months, charging they were linked to militant Islamic groups trying to topple President Hosni Mubarak.

This spring, Abou Elela tried again, and the difference was notable. The request was still rejected -- Egypt bans religion-based political parties -- but this time nobody was arrested, a fact construed here as a sign that Egyptian authorities are growing increasingly confident of success in their battle against extreme Islamic groups.

"The government stand has changed from aggressive to neutral," said Abou Elela, an engineer. "They have not approved of us yet, but it is a positive change."

Extreme versions of Islam, along with the militants who organized against Mubarak's U.S.-allied government, are still present in the Arab world's most populous country. But Egyptian officials note that the militants' campaign of violence, from the 1981 assassination of President Anwar Sadat to the 1997 massacre of dozens of tourists in Luxor, appears to be waning.

Interior Minister Habib Adly said in an interview that the organizations largely behind the violence, the Islamic Group and Islamic Jihad, have "lost their public base, lost their unity, lost a lot of their sources of finance."

The official confidence results in part from the apparent success of tough security measures -- strict emergency laws, sweeping arrests, military court trials and a heavy police presence -- that have been criticized by human rights advocates but defended by the government as justified. Despite controversy over the methods, secular analysts, human rights groups and Islamic activists agree that, at least for now, Egypt seems to have broken the militants' armed assault and reduced their pool of recruits through stricter control of mosques and the people who preach in them.

At the height of their underground campaign in the 1990s, militant groups bombed banks and attacked hotels and such popular tourist sites as the Cairo Museum, driving away the foreign visitors that are Egypt's chief source of hard currency. The attacks raised the specter of a pivotal pro-Western Arab country going the way of revolutionary Iran, violence-plagued Algeria or fundamentalist Afghanistan.

By contrast, the government is now steadily releasing thousands of prisoners. Virtually all of them, according to Adly, underwent religious counseling in jail and satisfied officials that they had adopted more temperate views.

In addition, the leadership and governing council of the largest militant organization, the Islamic Group, announced this spring that it is giving up armed struggle. After years of fighting and an estimated 1,200 deaths on both sides, the government seems as strong as ever, the public is alienated, and the radical leaders are largely behind bars, the group said. Armed struggle "proved its failure," said Montasser Zayat, one of the group's chief defense attorneys.

The Islamic Group's statement renouncing violence is viewed by some as a ruse, stemming from the fact that it was losing the battle; there has been no similar declaration by Islamic Jihad. Fresh arrests in connection with alleged terrorist plots occur regularly, and those involved frequently claim affiliation with new and unheard of organizations.

But the Luxor assault in 1997 was the last major attack. In addition, diplomats and others report that the frequency of run-ins between suspected militants and police in rural southern provinces have declined.

The militants "overplayed their hand and got isolated in public opinion and internationally," said Saad EddinIbrahim, a professor at the American University in Cairo and head of a research organization focusing on free speech. He said government efforts to improve services in some rural areas are also beginning to have an effect.

Some government tactics in combating Islamic extremists have been criticized, including group arrests of, as one activist said, "anyone with a beard," and the use of beatings and other abuse in interrogating prisoners, particularly suspected organizers. The delegation of most cases involving Islamic radicals to military tribunals also has restricted legal protections, and repeated renewal of emergency laws has allowed the Interior Ministry, in effect, to detain people indefinitely.

According to a recent report by the Egyptian Organization for Human Rights, cases involving more than 1,000 civilians were referred to military courts since 1992. Of that number, 94 people were sentenced to death and more than 600 given lesser sentences. Nearly 300 were acquitted.

According to one prison rights activist, however, inmate conditions have noticeably improved since Adly was named interior minister, shortly after the Luxor attack. The prisoner releases have lessened overcrowding in the jails, guards are less aggressive and information about those arrested is more readily available, said Mohammed Farei, head of the Human Rights Center for the Assistance of Prisoners, a group headquartered in the low-income Imababa neighborhood, once a center of radical activism.

Adly refused to say how many people remain imprisoned for alleged ties to the Islamic Group, Islamic Jihad or other militant organizations. Human rights and diplomatic sources say the number is likely still in the thousands.

As significant as the security crackdown has been, Adly said the government is also trying to regulate mosques and the training of people who preach in them more strictly so that militants cannot regenerate their ranks.

Storefront "people's" mosques were a main recruiting ground for radical groups, while militant thinkers -- such as Omar Abdel Rahman, currently jailed in the United States in connection with the World Trade Center bombing -- refined their views in a government-run institution, the prestigious Al Azhar University. Both the university and the ministry that licenses mosques now aim to allow only a "true" version of Islam, Adly said.

"The government policy concerning mosques is to make sure that they preach Islam . . . according to the right basics of the religion," Adly said. "We don't deny that those mosques had been used to call for fanatic ideas. Moreover, they were used as places to confer. By correcting the situation, the mosques will be places to go for the right, true, religious call."

According to the most recent State Department human rights report, the Cairo government expects to have all of Egypt's thousands of mosques licensed and administered by state-appointed preachers next year.

The effort to suppress militant ideas has been taken to prisons as well, Adly said, with a team of "sheiks and psychological analysts and sociologists" counseling detainees held because of their suspected militant links.

"If we discover that someone has changed his mind and abandoned his thoughts . . . and they are accepting the true thoughts and beliefs -- according to this we decide if he is to be released," Adly said.

Terrorist Attacks in Egypt

About 1,200 people, including civilians, policemen and Muslim militants, died between 1992 and 1997 during a campaign by Islamic militants to establish Islamic law in the country.

* October 1992: One person dies when a bus is attacked near Dairut, in southern Egypt.

* February 1993: Three killed, 18 wounded in bomb explosion at coffee shop in Cairo.

* October 1993: Three killed, three wounded in attack by gunman in coffee shop of Cairo hotel.

* March 1994: Woman fatally injured in gunfire on a cruise ship at Sidfa.

* August 1994: 13-year-old boy killed and three other people wounded in attack near Nag Hamadi.

* September 1994: One foreign tourist and two Egyptians killed in attack in Hurghada by suspected extremist.

* October 1994: One man killed, four wounded when suspected extremist fires on van near Naqada.

* April 1996: Gunmen kill 18, wound 17 at Europa Hotel near the pyramids in Giza.

* September 1997: Gunmen fire guns and toss bombs at tourist bus outside the Egyptian Museum in Cairo, killing 10, wounding 18.

* November 1997: About 70 people die, many of them Swiss and Japanese tourists, when gunmen burst into the courtyard of the Hatshepsut Temple outside Luxor and open fire.

CAPTION: A woman tries to talk to a jailed relative as he and 83 other suspected Islamic militants awaited trial in 1997. Egyptian officials say the militants' battle to overthrow the secular government and establish one based on Islamic law appears to be waning.

CAPTION: Military officials escort a tourist who survived the November 1997 attack at Luxor in which dozens of foreigners were slain.