Former Prime Minister Indira Gandhi was released from detention today, only 18 hours after her arrest on charges of corrupt practices and misuse of her official position.

Gandhi's release, ordered by Delhi metropolitan magistrate R. Dayal, who declared that there were "no grounds for believing that the accusation is well-founded," humiliated the government of Prime Minister Morarji Desai.

The government immediately filed a petition with the Delhi High Court challenging Dayal's findings. A source close to the prime minister said the government would question the magistrate's competence, claiming that he "exceeded his powers."

"The prime minister feels that the magistrate did not act in a judicious manner," said the source, who was in Desai's company throughout the day. He added that Desai had personally ordered police to offer Gandhi bail, but that if she refused the offer "she should be held in the lockup."

Before news of Gandhi's release was broadcast by All-India Radio, mobs in several cities rioted against her arrest. Shops were closed as a form of protest in several cities and members of Gandhi's Congress Party created uproars in several state assemblies.

About 400 persons, supporters and opponents of the former prime minister, got into a stone-throwing match outside the muncipal court on New Delhi's Parliament Street after police fired tear gas and arrested 111 persons. Another 13, including several police officers, were injured.

After her release, Gandhi visited some of the injured at Willindon Hospital, and then left by plane for Bombay on her way to a pre-arranged speaking tour of the western state of Gujarat, Desai's home. She told supporters at the Delhi airport that "these people" - meaning Desai's government - were still "after" her. She noted that her release did not mean that the government's case against her had been dropped.

A senior government official who is intimately involved in the case confirmed this, "It still stands," the official said. "It is cast iron. It's just a matter of presentation. The magistrate saw a deficiency in our presentation and thus did not meet his approval."

Despite the government efforts to put the best possible face on today's development, members of Desai's staff obviously were discouraged. At the prime minister's official residence, which Gandhi and her family occupied until her defeat in last March's national elections, members of Desai's staff were gloomily assessing Dayal's decision late tonight.

One senior staff member said that, while the case against Gandhi had not been dimissed, "No doubt it will appear to the public to have been thrown out."

A top-ranking civil servant who helped conduct the investigation against Gandhi faulted Desai's aides for succumbing so quickly to pessimism. "It shows they're new at the game," the official said. "Real professionals would turn this minor setback around to their favor."

The magistrate's decision took the government by surprise. Deasai, Home Minister Charan SIngh and other Cabinet ministers had stressed over the last few months that they would not move against Gandhi until they had an "ironclad case."

A government lawyer who helped prepare the findings against the former prime minister insisted there were no weaknesses in the case. "We have prima facie evidence against her," the attorney said. "I'm personally humilated, but the fact is that the magistrate based his decision on a stupidly technical matter. It's not at all that we didn't do our homework."

In his decision to release Gandhi, Dayal said in part: "The fact that even the source of the accusation has not been collected until now further indicates that there is nothing to show the existence of such grounds.

"Thus, there being no reasonable grounds for detention of the accused Srimati (Mrs.) Indira Gandhi, she is released forthwith."

One of the leading investigators in the case credited Grandhi and her lawyer, Frank Anthony, with "clever tactics" in refusing to accept bail, which she was offered when officers of the Central Bureau of Investigation arrested her at her home last night.

"The effect of her being released is the same as if she had been granted bail," the investigator said. "But by handling the matter they way she did, she has created real misapprehension in the mind of the public. That's why we're petitioning the High Court."

The government has charged Gandhi with two specific offenses. One is that she allegedly used her influence to acquire 104 new jeeps for use by her party in the March election campaign. The jeeps later were refurbished and sold to the army as unused, according to the accusation.

The second charge is that she allegedly influenced the award of an oil exploration contract to a French company despite the fact that a U.S. company had offered to do the same work for $12 million less.

[In Paris, the state-controlled French Petroleum Co. denied that it had any role in the charges, UPI reported. A company spokesman said, "We categorically deny any involvement in India's corruption affair," and noted that the contract had been ratified in April by Desai's government.]

In addition to Gandhi, police arrested four former members of her Cabinet, two former government secretaries and three prominent industrialists. All were released today on bail. "This is standard procedure in cases like these," a governdment official said.

According to the official, the government is concurrently carrying out investigations against the former prime minister and some members of her "inner circle" in at least 48 other cases involving corrupt practices.

These investigations, which Gandhi and her younger son, Sanjay, have characterized as a "witch hunt," resulted from alleged excesses committed during the 21-month period of emergency rule that Gandhi imposed in June 1975.

The emergency period produced a public outcry aginst such practices as the enforced sterilization of hundreds of thousands of Indian men and boys. The government's investigations, however, do not deal with these issues.

These have been turned over to a special commission headed by former Supreme Court Justice J.C. Shah. The commission, which suspended its work yesterday, is scheduledto resume on Oct. 26. There were rumors in New Delhi today that Shah, a highly respected jurist, had resigned after Gandhi's arrest, but the government squelched the story after Shah met with Desai this morning.

A senior government official charged the government with "undue haste" for arresting Gandhi at this time, rather than waiting for the commission to announce its findings. The effect, he said, was to defuse the momentum the commission was building.

"But that's the fun, as well as the weakness, of politcs in a democracy," the official said. "Like politicians everywhere, ours are impatient." He explained that the government felt itself under mounting public pressure to "do something" after being in office for seven months.