Indian Prime Minister Rajiv Gandhi today told a cheering Parliament that an agreement had been reached with moderate Sikh political leaders that would end a possible secessionist movement in the strategic state of Punjab, which has been wracked by terrorism and sectarian violence for the past three years.

The agreement appears to meet many of the demands of the Sikhs, an offshoot religion combining Hinduism and Islam whose 14 million members make up only 2 percent of India's overwhelmingly Hindu population but who make up 18 percent of the military and police command.

Sikhs are concentrated in Punjab, the state on India's western border with Pakistan that has become India's breadbasket.

As part of the agreement, Hindu areas of Punjab will be transferred to the neighboring state of Haryana, assuring a Sikh majority in Punjab, where Sikhs now make up about 60 percent of the population. In addition, the federally administered city of Chandigarh, which serves as the capital for both states, will be turned over to Punjab.

"This brings to an end a very critical period in the history of our country," said Gandhi, whose mother, the late Indira Gandhi, was assassinated last Oct. 31 by Sikh extremists in her personal bodyguard. "Now we begin a new phase of working together to preserve the unity and integrity of the country," he said.

Sikh terrorists set off a series of bombs, mostly hidden in transistor radios, in crowded bus terminals and other public places here and in other northern Indian cities in May. The government said 49 persons were killed in the blasts.

The assassination and the bombs were seen to be a form of revenge by Sikh extremists for the Indian Army storming of the Golden Temple, the Sikhs' holiest shrine, over a year ago. The temple in Amritsar had been turned into a fortress by secessionists seeking a separate Sikh nation.

The Sikh unrest was considered the most explosive domestic issue to confront India since it won independence in 1947.

The agreement was also hailed by Sant Harchand Singh Longowal, leader of the Akali Dal, the moderate Sikh political party, who signed the accord after two days of talks here with Gandhi and other high-level officials.

It was the first meeting between the top leaders of India's government and Longowal, the leading moderate Sikh political leader, since early last year when a previous round of talks with Indira Gandhi's government broke down.

"The period of confrontation between the Akalis and the center is over," said Longowal. "We are fully satisfied with the package."

Immediately after signing the accord, Longowal and his chief lieutenants went to the largest Sikh temple in New Delhi, the Gurdwara Bangla Sahib, to offer prayers. He was cheered by other Sikhs there and said he will return to Punjab "victorious" because all his Sikh party's demands had been met by the Gandhi government.

While the agreement generally was hailed as a triumph for Gandhi's new policy of conciliation on the divisive sectarian problems that confront this nation of 750 million, the accord with Longowal and his Akali faction still faces major hurdles before peace in Punjab becomes a reality.

It remained unclear tonight, for instance, whether the government concessions would be enough to satisfy Sikh extremists, some of whom have been demanding an independent Sikh state, to be known as Khalistan, in Punjab.

Signs of trouble emerged last night, as militant Sikh students prowled the streets of Chandigarh and Amritsar shouting anti-Longowal slogans, Reuter reported.

Furthermore, according to political observers here, Hindu nationalists, who have become more vocal in recent years, may fight Gandhi for going too far in appeasing the Sikh minority.

There may also be strong opposition from Haryana, which relies on the same river waters as the other western states for its agricultural successes.

The former chief minister of Haryana, Devi Lal, an opposition leader, said the Punjab accord did an "injustice" to his state.

But the reaction last night from opposition parties as well as Gandhi's ruling Congress (I) Party was almost universally favorable. Fifty members of Parliament issued a statement praising the agreement, which they said would end confrontation.

The agreement came last night after 30 hours of continuous talks that began Tuesday.

A key victory for Gandhi was Longowal's consent to work within the framework of India's constitution, which rules out the possibility of a separate Sikh state. But Gandhi agreed to refer pleas for greater autonomy in a largely Sikh state to a committee currently studying problems in the relationship between India's strong central government and the country's states.

The government also promised to end the broad powers of extra-constitutional search and seizure that were given the Army to keep order in Punjab.

Those powers have been a major irritant to Sikhs all over the country who felt they were being singled out for harsh treatment. In addition, the special courts would lose control over all cases but those involving terrorism and hijacking.

There was no word in the agreement about holding local elections in Punjab, which has been under central government rule for more than two years.