HAVANA, JULY 16 -- All 12 Cubans who had been sheltered in the Czechoslovak Embassy here since last week left the embassy voluntarily tonight, the Cuban news agency Prensa Latina said.

The agency, quoting a Foreign Ministry statement, said the 12 surrendered unconditionally to the Cuban authorities and for this reason would not be punished.

Five other Cuban refugees remained occupying the house of the Czechoslovak charge d'affaires in the Cuban capital, the statement said.

Earlier today, seven of the Cubans took five of their countrymen, already in the embassy, as well as five Czechoslovak diplomats hostage. Later they freed the diplomats.

The group of seven Cubans had demanded a plane to take them to the United States. But a spokesman for the U.S. Interests Section in Havana said it had received no formal request from either the Czechoslovak Embassy or the Cuban government for clearance to fly a plane to take them to the United States.

The five diplomatic hostages, looking shaken but apparently unharmed, came out of the compound, where they had been held for more than five hours.

They included senior envoy Zdenek Smakovsky, who had arrived in Havana Saturday to help defuse a dispute with Cuba's Communist authorities over the 12 Cubans, who took refuge at the Czechoslovak Embassy last week.

The government, in an official statement had urged the Cubans to leave the embassy and said the government would not negotiate their departure.

Czechoslovak diplomats say the five taken hostage, the first refugees to enter the embassy a week ago, are political dissidents. The diplomats have expressed some doubts about the exact identity of the other seven, who entered the embassy last Wednesday despite a police guard.

The seven had threatened to "blow up" the embassy if their demands were not met. But the diplomatic sources said they were apparently not armed with guns and had used threats of violence to subdue their hostages.

The sources said there had been a fight between the two groups of refugees when the seven broke down a door and entered a room where the others were sheltered.

It was the second hostage incident here in the past week. Thursday, five Cubans occupied the apartment of the Czechoslovak charge d'affaires and held him hostage for several hours.

The asylum seekers have strained relations between Cuba and Czechoslovakia, whose new non-Communist leaders have criticized the human rights situation here and asked that the 12 be allowed to leave Cuba.

The refugee crisis has also put Cuba at odds with Spain. Madrid protested after Cuban authorities chased an asylum seeker onto the grounds of the Spanish Embassy and hauled him away Sunday.

President Fidel Castro on Saturday said, "No European embassy has the right to receive so-called refugees because there is no asylum agreement with these countries and such an act constitutes a flagrant violation of diplomatic rights and immunities. No Cuban citizen will ever leave the country by this means," according to the official newspaper Granma today.