Greece's conservative opposition and Communists joined the ruling Socialists in Parliament today in unanimously enacting vanguard legislation declaring torture a crime against the state, with sentences ranging from three years to life imprisonment.

"The bill is the translation of the experiences of our people into a code of justice with a significant ethical message," Justice Minister George-Alexander Mangakis, one of the many members of the Socialist government imprisoned and tortured by the military dictatorship that ruled Greece from 1967 to 1974, told legislators.

Mangakis' book, "Letter From Prison," brought the brutality of the dictatorship to world attention after it was smuggled out of the country in 1971 and published abroad.

"I specifically recommended that torture be put in the penal code right up there with high treason as a crime against the state and not the individual, because torturers are made by the state, not born, and because no state under which torture is carried out can be called democratic," said Antonios Vgontzas, Mangakis' chief adviser on the drafting of the bill.

Vgontzas said that declaring torture a crime against the state represented a new legislative approach. "In most countries torture is penalized under general legislation such as that covering bodily harm," he said. "Now in Greece we have a coherent and specialized body of law to do this."

Passage of the bill comes as the United Nations prepares for discussion later this month of the final draft of an international convention against torture. The convention is the result of a Greek initiative launched in 1975, the year after the collapse of the military dictatorship.

Vgontzas said the Greek bill was largely inspired by the frustration following the 1975 trials here of suspected torturers, in which many defendants received light sentences. Of the more than 20 persons convicted, only four are reported to be still in jail. Two prominent torturers who received light sentences were later murdered in unsolved revenge killings.

The bill defines torture broadly, to include not only the infliction of bodily and psychological pain, but also the use of drugs "or any other natural or artificial means to break the will of the victim." It also bans any action "injuring human dignity," specifically prohibiting prolonged isolation and use of lie detector tests to extract confessions or other information. Waiving of the law in "emergency situations" is expressly rejected.

The bill provides maximum sentences of 20 years, except for a life sentence in cases where the victim dies as a result of torture.