Poland's main independent trade union movement, Solidarity, today called off a threatened general strike in the Warsaw region following the dramatic early-morning release of two imprisoned workers.

After an all-night meeting, the presidium of Solidarity's Warsaw branch announced that it would hold talks with government representatives later today for the appointment of an official commission to examine the union's other grievances. These include demands for the freeing of four other political activists and a reduction in the powers of the country's security apparatus.

The decision removes, for the moment at least, the prospect of a major confrontation between the Polish government and the union. Plans had been made for up to 2,000 factories in the Warsaw region to stop work from noon today.

The breakthrough came shortly after 1 a.m. when Jan Narozniak, a volunteer worker in Solidarity's Warsaw office, was released from police custody. It was his arrest last Friday, on a charge of disclosing state secrets, that sparked the latest crisis.

Freed with him was Piotr Sapielo, a worker in the prosecutor general's office, who is alleged to have leaked a secret document to Solidarity outlining instructions to the legal authorities for the harassment and prosecution of dissidents. Upon their release, both men were immediately taken to strike headquarters at the Ursus tractor plant outside Warsaw.

The men's appearance was greeted with delighted cheers at the plant, which striking workers have been occupying since the weekend in protest against their detention. Posters demanding the release of Narozniak, a student at Warsaw University, have appeared throughout the capital.

After its meeting the presidium of Solidarity's Warsaw branch decided to end the strike alert pending the appointment of a government commission. But it was decided that one major plant, the Warsaw steelworks, was to remain closed until full agreement with the commission has been reached.

The last-minute compromise came as a relief to authorities anxious to avoid a confrontation with the union federation on the highly sensitive issue of the power of the security establishment. But lengthy negotiations remain likely on the workers' demands for a review of the operations of the prosecutor's office, the police and the secret police.

Observers said it also would be difficult for the government to agree to the union demand for the release of four political dissidents arrested over the last three months. The dissidents include a right-wing nationalist, Leszek Moczulski, who has been accused of calling for the overthrow of the communist government in Poland.

By the time of the release of Narozniak and Sapielo, strikes had already begun in some sectors.

The circumstances surrounding the two men's release were not immediately disclosed, and it was unclear whether charges against them had been dropped.

After a day-long meeting in Gdansk, Solidarity's national committee yesterday issued a statement accusing the Communist Party authorities of trying to provoke a confrontation. The statement said the union would use all means at its disposal to defend the demokcratization process in Poland and raised the possibility that a new wave of strikes could spread outside the capital.

The strike call was aimed at hundreds of plants in the Warsaw area. Exceptions were made only for public transport and plants whose closure would "inflict damage on the Warsaw Pact," an apparent refernce by Solidarity to armaments and other defense-related industries.

The government has been particularly sensitive about Solidarity's protests against the secret police. Politically, any reduction in the power of the security services would pose tremendous difficulties for the Communist Party, since this would undermine an essential pillar of its own authority.

A ray of light for the government in an otherwise bleak industrial scene was yesterday's decision by railway workers to call off their strike, which was described by the Soviet new media as a possible threat to Poland's security. This followed an agreement with a government commission over play.

Meanwhile, workers in at least two towns continued to occupy administrative officies, an increasingly common form of protest. And in the southern industrial region of Silesia, work at about 30 coal mines was interrupted because of a dispute on miners' pay.

The militancy of Solidarity members in Warsaw was reflected at a meeting at the Urus tractor plant, which has become a makeshift strike headquarters. As delegates from one Warsaw factory after another, from the steelmill to the waterworks, announced plans to take part in the strike, they were greeted by loud applause.

Yesterday, several factories in addition to the Urus plant staged protest strikes. Bus and trolley drivers showed their sympathy for the strike by sticking posters to their vehicles saying, "Free Jan Narozniak -- Stop Illegality."

Many newspaper kiosks in Warsaw also refused to sell copies of the official press in a gesture of protest and displayed little red and white Polish flags.