ATHENS, JULY 24 -- The Greek Parliament narrowly ratified a defense treaty with the United States today that will allow two American bases to remain on Crete for at least eight more years.

The treaty, which guarantees U.S. help if Greece is attacked, has been a divisive issue in Greek politics, and hundreds of anti-base demonstrators clashed with police Monday near the city of Khania on Crete. Three policemen were reported slightly injured after being shot by demonstrators.

The parliamentary approval ended more than 18 months of uncertainty over the the bases. The previous defense treaty expired in December 1988 but was extended as negotiations continued through several changes of government in Greece.

The 300-member Parliament voted 151 to 144 to ratify the pact, with one abstention. Four deputies were absent.

A State Department official, requesting anonymity, said that the United States considers the pact an executive agreement, which would not require ratification by Congress.

The treaty allows the United States to continue operating two major military bases on the island of Crete -- a naval support facility at Souda Bay and Iraklion Air Station near the village of Gournes.

Two bases near Athens -- a Navy communications station at Nea Makri and the Hellenikon Air Base -- have been slated for closing by the Defense Department as a cost-cutting measure.

On Crete, a coalition of leftist groups opposed to the U.S. bases staged demonstrations in Khania on Monday. As many as 2,500 people took part in the protests, according to witnesses.

Police fired tear gas to prevent demonstrators from entering a municipal building to deliver a petition, the Public Order Ministry said.

Clashes then broke out, and three police officers were hit by gunshots, the ministry said. Another five officers were injured by gasoline bombs and stones hurled by demonstrators, it said.