Thousands of screaming Puerto Ricans tore down fences and surged against police lines today to greet four terrorist heroes of the nationalist movement returning to Puerto Rico after a quarter century in U.S. prisons.

The four, who were freed on Monday, wept as they embraced relatives and friends on arrival at San Juan Airport. Supporters, estimated at about 6,000 strong, madly waved a sea of flags and banners near a makeshift speakers' platform, shouting, "Viva Puerto Rico libre" and "Jibaros si, Yanquis no." Jibaros are native Puerto Ricans.

Their loudest cries were "Lolita! Lolita," for the still-fiery Lolita Lebron, 59, the leader of a group that shot up the House of Representatives in 1954, wounding five congressmen. "You must know the facts," she shouted at the crowd, her voice hoarse from two days of speeches. "The United States will repress anyone that tries to assert their birthright on nationhood." The crowd roared its agreement.

Oscar Collazo, 67, who tried to assassinate President Truman in 1950, told the people to ignore the tears on his face. "I am so happy to be in a place where I am not afraid to express my emotions," he said.

With them at the airport rally were Irving Flores Rodriguez, 53, and Rafael Cancel Miranda, 49, who also participated in the congressional shooting. All four were granted clemency by President Carter last week and released from prison Monday.

Airport officials said the crowd had been well behaved and well organized until the flight arrived from New York. Then the crowd broke through retaining fences and pushed police against a security barrier, shouting, "Welcome, Lolita" and slogans of unity.

The arriving party had a hard time even getting into a specially reserved airport building because of the crush of reporters, photographers and others who had wormed their way past the guards out of sheer love.

"This is the proudest moment of my life," Lebron told the crush of reporters,"I thank God for his guidance."

The day also brought some sorrow, however, when a niece of Collazo collapsed just after hugging him and was pronounced dead on arrival at the hospital. Irma Collazo, 45, apparently died of a heart attack, a hospital spokesman said.

Flores and Cancel were less emotional than Lebron but every bit as determined. Enthusiastic crowds had marked the group's appearance Monday in Chicago and Tuesday in New York, Cancel told the throng, adding, "The heart of the Puerto Rican people that was oppressed by so long in prison began to beat again in Chicago and New York."

Flores echoed the note of a nation rising that has marked all the group's stops: "I call on all my people from my patriotic heart of hearts to unite for a free Puerto Rico."

The celebration later moved across San Juan to the city cemetery, where Lebron kissed the tomb of Pedro Albizu Campos. Campos, who died in 1965 after galvanizing the nationalist movement to its peak in the 1930s, was "the salvation of our country. . .God gave him to us," Lebron said.

The crowd fell silent as Lebron prayed to God to grant independence to the island. With her was an honor guard of party members dressed in black and white, and wearing armbands with the party's white iron cross symbol.

The returning nationalists have made it their mission to unite the four badly divided wings of the Puerto Rican independence movement into a cohesive force. They have said they hate violence but repeatedly have refused to rule it out as a method of achieving their goal of an independent Puerto Rico. They accused the United States of having begun any violence by repressing the aspirations of the island's 3.2 million people.

Although the combined independence advocates have never been able to muster more than 6 percent in any electoral test, there was wide sentiment on the island for release of the four nationalists on grounds they had been in prison longer than any other federal inmates.

Juan Mari Bras, head of Puerto RicoS Socialist Party, and Ruben Berrios, chief of the Puerto Rican Independence Party, met the group at the airport. The Puerto Rican Nationalist Party has been largely inactive for the past 25 years, but its president, Carlos Velez Rickenhoff, has been with the four since their arrival in Chicago.

Mari-Bras said at the airport that he had come in response to the group's call to get together. "I hope that the moral force they represent will help us arrive at this unity," he said.

Today's spectacular reception and the earlier rallies in the United States were organized by a group of lawyers and Nationalist Party members who called themselves The Committee for the Liberation of the Puerto Rican Political Prisoners. San Juan attorney Luis Abreu said the group began planning in 1975 to try for the release of Lebron and the others. "Individuals were writing and rallying then, but there was nothing cohesive or organized," he said in an interview.

Raising money through concerts, benefits, art sales and street collections, he said, the committee established itself in Chicago and New York. Although all of the four nationalists refused to ask for parole, since they did not recognize U.S. government authority over them, the lawyers made repeated presentations to U.S. courts on their behalf.

On release the prisoners insisted that Carter's action to free them was one of political expediency, related to coming elections and the recent conference of nonaligned nations in Havana, rather than the "significant humanitarian gesture" that the president had called it. "If it had been humanitarian, I would have been out a long time ago," Collazo said in New York.

The nationalists and their call for a renewed drive for independence will inject an unknown factor into the already turbulent politics here. Gov. Carlos Romero Barcelo, who must stand for reelection next year, objected to the prisoners' release on just this ground. He is an avid supporter of statehood and has promised a referendum on the subject of the island's status if he is reelected. Carter, whose supporters here will try to deliver him the island's 41 delegates to the Democratic National Comvention, has promised to abide by the results of that plebiscite.

But the nationalists have denounced any island vote as fraud controlled by the mainland, and island politicans fear a resurgence of violence that has accompanied strong nationalist feelings in the past.

Lebron today recalled the island's patriotic history, referring to the "shout from Lares" of Sept. 23, 1868, when rebellious Puerto Ricans first tried to declare independence from Spain. "It is up to us to recapture that spirit and that movement," she said.