The arrest and subsequent release of former Prime Minister Indira Gandhi has triggered a torrent of heated argument throughout India.

Newspaper editorials and readers debated today for and against Gandhi, who ruled for 11 years: for and against her accuser, Morarji Desai, who came to power in March.

There is a single point, however, at which all sides converged: that the 21-month period of autocratic emergency rule that Gandhi imposed before being voted out of office must not be allowed to recur. In vivid contrast of its neighbor to the west, Pakistan, democratic principles appear to be firmly rooted in India.

For example, The Statesman, published in New Delhi and Calcutta, criticized the government for the clumsy way in which it made the initial presentation of its case against Gandhi. These steps, the paper said, could give her "the chance to win back public sympathy to challenge of government born out of the sorrows of the emergency."

Indians are once again proud of their democracy, prouder still for reinstating it themselves at the ballot box and determined that Gandhi's "emergency" will be relegated to a footnote in history as an aberration.

They would like to view the brief slide into authoritariaanism as an exception which proves the rule that India despite its crushing poverty, its vast and diverse population, and its incredible burden of development, is determined to work out its problems as a democracy.

To see just how rare India democracy is, one need look no further than Pakistan.

India and Pakistan became independent nations at the same time, 30 years ago. At the insistence of Indian Moslems, imperial Britain carved Pakistan out of India in 1947 and then set the two new states free.

Both nations began as parliamentary democracies, styled after the British model. Yet, in a decade, Pakistan slipped under military dictatorship, except for a few unsteady attempts at vaguely democratic norms, it has remained a dictatorship.

Perhaps at no time in their parallel histories has the comparisons between India and Pakistan been more stunning than this year.

Last March, after imposing her personal will on the population for nearly two years, Gandhi suddenly announced that there would be nationwide elections. Her opponents were released from jail with just a few weeks to organize and mount a campaign.

The voting was, according to virtually all accounts, free and fair. To the surprise to everyone - the hurriedly assembled opposition Janata (People's) Party, international observers and Gandhi herself - she was defeated.

Perhaps just as surprising, the imperious prime minister, once called the empress of India, calmly stepped down. There were rumors at the time that when she saw the tide turning against her she tried to bring out the army and call off the elections. But this did not happen.

Just before India went to the polls, the people of Pakistan voted in what Prime Minister Zulfiqar Ali Bhutto hailed as his country's first genuinely democratic elections. Bhutto had come to power five years earlier after his country lost its eastern wing - now Balgladesh - in a war with India. He was returned with what appeared to be a sweeping mandate.

But Bhutto's opponents, a ragtag band, like Gandhi's foes cried foul. Claiming that the polling had been "massively rigged," the opposition Pakistan National Alliance took to the streets. In a matter of weeks, more than 300 persons were killed. In July, Gen. Zia Ul-Haq overthrew Bhutto in a bloodless coup, and once again Pakistan was a military dictatorship.

So it remains Zia promised elections for this months, but last week he postponed them indefinitely. Early last month, Zia had Bhutto arrested on a charge of conspiring to kill one of his political opponents.

When a high court judge in Lahore set the deposed prime minister free on $15,000 bail, Zia fired Chief Justice Yakub Ali Khan before the Supreme Court could hear Bhutto's petition. Then Zia had Bhutto plucked from his bed before dawn and tossed back into jail. This time, he is not entitled to an appeal.

Zia has publicly charged his former commander-in-chief with kidnapings, murders and running a gestapo-style regime. He has left no doubt that he will not tolerate Bhutto's return to politics.

By contrast, Indian Home Affairs Minister Charan Singh told journalists yesterday that while the excesses Gandhi allegedly committed during the emergency "called for a trial on the Nuremburg model," the government was limiting its formal charges to specific offenses "which she has prima facie committed."

When Delhi Municipal Magistrate Rameshwar Dayal released Gandhi later in the day, the government responded by filing a petition with the high court, challenging Dayal's competence.

Perhaps because Singh is known as a sworn enemy of Gandhi and her late father, Jawarharlal Nehru, he took pains to explain that, "in any case, it would be for the courts to pass judgment on those matters. On our part, we have no intention whatsover of detaining Mrs. Gandhi without trial."

It can be argued that the Desai government faces far less a problem with Gandhi than Zia does with Bhutto. Although she has received enthusiastic receptions at a number of speaking engagements recently, Gandhi is not yet seen as a serious threat to the government. Bhutto, if he were returned to office, probably would seek Zia's head, perhaps in the literal sense.

Although Gandhi says that Desai's actions against her are politically motivated, several independent analysts in New Delhi doubt this. "The government has no need to destroy her," one of these observers said. "There's sufficient opposition to her even in her own party to keep her from returning to power in the foreseeable future."

Furthermore, the Desai government, from genuine commitment as well a certain knowledge that the people of India would not tolerate any extra-legal actions against Gandhi is proceeding according to the strictest letter of the law.

That sort of commitment has been lacking in Pakistan since its birth. There are several basic reasons:

First, Pakistan started out with such deep-rooted problems that it immediately required a measure of authoritarian leadership just to be able to tread water.

Second, its leaders traditionally have come from the landed aristocracy, a class with less respect for democratic norms than the small-town lawyers who formed the core of India's leadership.

Third, the Pakistani army has always been a prominent feature on the political scene. The Indian army, like those in the United States and Britain, has stayed clear of politics.

These basic factors remain unchanged on both sides of the border, giving India as good as chance as any nation of staying on the course of democratic rule, while Pakistan seems likely to continue as the late dictator Ayuh Khan once said "from crisis to crisis" down its own road.