Thousands of Indians violently protested yesterday against the jailing of former prime minster Indira Gandhi and hijackers commandeered an airliner with 132 aboard for several hours to demand her release.

Nationwide, five persons were killed, hundreds injured and an estimated 15,000 jailed in the challenges to the government that replaced - and then imprisoned - Gandhi.

According to news agency accounts of the hijacking, two alleged members of the youth wing of Gandhi's Congress Party held the seized Indian Airlines Boeing 737 at Benares airport, 375 miles southeast of New Delhi.

After holding the passengers and crew overnight, and demanding Gandhi' release, they freed the hostages unharmed this morning.

The Press Trust of India reported that the hijackers, armed only with toy pistols and a cricket ball, were taken into custody after they flew to the nearby Uttar Pradesh capital of Lucknow in the private plane of the state's chief minister - who negoitiated the release.

The widespread disorders broke out after Gandhi was imprisoned Tuesday. Parliament had voted to expel her and send her to jail for contempt and breach of privilege.

India has been shaken by a stubborn streak of communal, caste and political violence in recent months, and some observers expressed fears yesterday that the swirl of demonstration by Gandhi's supporters would escalate in such a climate.

Others cautioned, however, that sporadic violence has becom part of politics in India in recent years and that there were no signs so far that Gandhi' backers were planning sustained and more violent confrontations.

Parliament voted to oust Gandhi and jail her following a week of intense debate on the findins of a parliamentary committee.The panel ahd ruled that when Gandhi was prime minister, she and two aides ordered the harassment of four government officials pressing a parliamentary investigation into a company run by her son, Sanjay. She was ruled in contempt for refusing to testify abouth the matter under oath.

As the demonstrations erupted around the country, Gandhi, 61, sat in a freshly whitewashed cell in Delhi's main jail, where she enjoyed a television set and a dinner brought in by her daughter-in-law.

The treatment was far gentler than that given many of thousands imprisoned during Gandhi's 19 months of emergency rule prior to her political defeat in March 1977.

The former prime minister is to be freed from her cell when Parliament ends it current session, which could be as early as Friday. She has said she will run again for a new seat, perhaps the one in southern India which she held for only a mont before Parliament ordered her ousted.

The Indian Airlines plane, on a flight from Calcutta to New Delhi with stops in Ranchi, Patna and Lucknow, was hijacked just before it was to land in New Delhi, according to an airline spokesman.

According to nes agency accounts, the men, identified as members of the youth wing of Gandhi's party, broke open the door of the cockpit, distributed pro-Gandhi pamphlets to passengers and shouted "Long Live Indira Gandhi."

They ordered the plane flown back to Benares, a holy city on the Sacred Ganges River.

It was not clear where the men boarded the plane or how they got aboard with weapons. Airline officials said both hijackers called themselves Pande, a common name in northern India.

Chief Minister R.N. Yadav of UttarPradesh state negotiated last night with the hijackers by radio from the airport control tower according to the reports. There was no immediate word on what agreements he struck with them to secure the passengers' release.

At Lucknow, the hijackers shouted "Long Live Indira Gandhi" as they were taken to a waiting car by security guards. The hijackers told a reporter they had been armed only with toy pistols and had pretended the cricket ball was a hand grenade when they told the pilot they were taking over the plane.

In addition to the two hijackers, the agency dispatches said, 123 passengers and six crew members passed the night on the plane. Three foreigners were reported among them, two of them were American, according to State Department sources.

One passenger had escaped or was allowed to leave the craft shortly after it landed in Benares. The airline said the hijackers had demanded during the subsequent bargaining to speak with Prime Minister Morarji Desai, who led the move in Parliament th have Gandhi ousted and jailed.

News agencies reported that demonstrators were in the sstreets in cities throughout the country pressing for her release. Many of the most violent confrontations appeared to be in areas of southern India controlled by Gandhi's political party, a wing of the Congress party that her father, Jawaharlal Nehru, once headed.

In Bangalore, police opened fire on stone-throwing mobs, killing four persons, according to the accounts. It was in Chikmalagur, near Bangalore, that Gandhi was reelected to Parliament in a by-election politics.

In Cannonore, in southern Kerala stat, a Gandhi supporter was reported stabbed to death by a backer of Desai's Janata Party.

Buses were reported set ablaze in Bombay and railway cars in Bangalore. Mobs in Calcutta and Madurai were said to have burned effigies of Desai. In Hyderabad, Secunderabad, Nagpur, Madras and other cities, according to the reports, post offices, railway stations and All-India Radio stations were attacked. Gandhi has charged the government-run radio is biased against her, a sharp reversal from the days of her emergency rule.

Some of the most violent outbursts were reported in the southern state of Tamil Nadu, formerly known as Madras, where 8,000 persons were arrested.

In the capital, New Delhi, police fired warning shots and lobbed tear gas cannistes and 2,500 paramilitary border guards were placed on alert, according to The Associated Press.

One of the more grisly incidents was reported in Bombay, where a polieman was set on fire by a mob that pured gasoline over him and ignited it. He was hospitalized.

Most of those arrested apparently resorted to the old techniques of civil disobedience developed during the Indian nationalist movement. According to the news agency accounts, the protesters would line up after being arrested for violating bans on street marches and cheerfully board waiting police vans.

In Parliament, where a cheering majority of 279 to 138 voted Gandhi's ouster and jailing Tuseday, the former prime minster's supporters forced the upper house to adjourn by shouting antigovernment slogans and refusing to leave the chamber. Seven of her supporters went on a hugner strike.

Meanwhile, two aides to Gandhi whhen she was prime minster, R.K. Dhawan and Zevendra Sen, were arrested and taken to jail in connection with events which led to Gandhi's own jailing.

Not even the revered world of cricket was left untouched b the unrest. A match between India and the West Indies in Bangalore was postponed because of the violence.