A woman terrorist bungled an attack on Peruvian President Alan Garcia as representatives of the world's socialist parties gathered here today in the wake of the government's suppression of three prison uprisings that left at least 260 jailed leftist guerrillas dead.

In his first public comment on the jail revolts, quelled yesterday in savage fighting between Peruvian marines and the rebels, Garcia defended his administration's tough response, saying that democratic governments cannot appear weak in the face of violence and must enforce their authority.

Shortly before the Peruvian leader spoke to the opening session of the Socialist International, a woman tried to fire a homemade mortar at the downtown convention hall, where the conference was taking place. She accidentally blew herself up when the crude weapon backfired, according to police and witnesses. The woman was positioned on the top of a six-story building, two blocks from the hall.

The failed attack occurred about half an hour after the time Garcia had been scheduled to arrive, but before he actually reached the conference building, which was ringed with police holding automatic weapons. There was no official word on the woman's identity.

Amid continuing tension and public fears of fresh terrorist strikes, police reported explosions or fires set last night at three movie theaters in the capital.

In view of the deteriorating security situation, two prime ministers, Bettino Craxi of Italy and Gro Harlem Brundtland of Norway, canceled plans to attend the meeting. Some Europeans already here -- among them, Willy Brandt, leader of the West German Social Democratic Party -- were reportedly concerned about continuing the meeting, particularily if it might be viewed as a preliminary endorsement of the Peruvian government's management of the prison rebellions.

As authorities sifted through the rubble of the prison pavilions that had been seized early Wednesday by jailed members of the Sendero Luminoso (Shining Path) movement, relatives of the killed rebels protested the government's handling of the crisis and Lima students also demonstrated against the hard-line action.

"The military has now carried out the plan of genocide drawn up some weeks ago," said Marta Huatay, a member of a left-wing lawyers' association. "Garcia has given carte blanche for the armed forces to kill."

Other Peruvians privately criticized the president's decision, unanimously endorsed by the Cabinet, to throw the full force of Marine and police units so quickly against the rebels. A former chief of prisons said Garcia should have tried waiting out the protest by turning off water and electricity supplies to the captured cellblocks.

But most people in this violence-wracked country appeared to favor the president's tough response. Peru's most prominent politicians and the Roman Catholic Church issued statements of support.

Garcia's own popularity rating has remained remarkably high since he took power in July 1985. In contrast, Sendero, the most enigmatic and secretive of all Latin American guerrilla bands, has a narrow following in the country, even among leftists.

In today's speech, Garcia said the prison uprisings, which the government has said were clearly coordinated, had been "done so as to blackmail our democracy in front of the peoples of the world with criminal acts."

Members of the government's Peace Commission had "urged the rebels to surrender," Garcia said. "This attempt failed, and the state was forced to impose its authority.

"This is not the brute strength of a dictatorship nor that of tyranny," he continued. "It is the authority and moral strength of the people. It is the authority and inflexible strength of the law, because the government must stand firm and be severe if the people are to be respected."

At the time of their attempted takeover, the rebels issued a list of 22 demands. They objected to recent and planned transfers of some Sendero members to a new high-security prison and also demanded expanded visiting privileges. They requested treatment under the Geneva Convention for prisoners of war and insisted the government live up to previous commitments for prison reform.

Though there was no further official word during the day on the number of deaths, a senior government source reported 138 guerrillas killed at the El Fronton island prison, 126 at giant Lurigancho Penitentiary on Lima's outskirts, and two at the Santa Barbara women's prison at the nearby port of Callao. The government yesterday reported three Marines dead and about 20 wounded in the battles. Of nine hostages reportedly taken at the beginning, some were wounded but at least eight were reported to have survived.

Fighting was heaviest at El Fronton, located several miles off the coast from Callao, where security forces spearheaded by a Marine demolition unit took 34 hours to retake the prison.

Guerrilla snipers with automatic weapons slowed the military's assault. Inmates in a two-story cellblock known as the Blue Pavilion were barricaded behind bunkers of concrete and stone constructed over the past two years using material smuggled in by visitors or given by prison officials who thought it was for repairs, according to prison sources.

In addition to firearms, the guerrillas had dynamite and other explosives as well as a variety of homemade weapons, including lances, crossbows and knives.

They had built a maze of tunnels leading from the pavilion to the sea. Many of these fortified underground passageways collapsed in the fighting, leaving prisoners buried beneath tons of rubble and complicating the death count.

The government yesterday reported only 30 bodies recovered at El Fronton. Another 30 rioters surrendered. The rest of the estimated 150 guerrillas in the prison when the rebellion began are presumed dead.

A senior Garcia aide, who asked not to be named, reported that the mutineers died singing "We Shall Overcome" over the din of combat.

At Lurigancho, the country's largest prison, virtually all the guerrillas housed in the so-called Industrial Pavilion are said to have perished. The military said many of those killed had been asphyxiated or burned alive in fortifications they had built in the cellblock.

Among the dead is Antonio Diaz Martinez, considered a Sendero leader. The movement, founded in 1970 by pro-Maoist professors at the University of Huamanga in Ayacucho and involved in terrorist attacks since 1980, is structured on a pattern of highly disciplined and secretive cells, whose members rarely know one another.

An unspecified number of common criminals are said by some sources to have also died in the fighting at Lurigancho.

At both El Fronton and Lurigancho, Sendero members had been concentrated in buildings seperated from other prisoners.