Without warning, at 10 p.m. last night, the French government released a man who had been held in a Paris prison for nearly seven months without trial on charges of spying and planning to spread "disinformation" on behalf of Libya.

Upon his release, writer-adventurer Roger Delpey, 54, promised to loose a new whiff of scandal about French President Valery Giscard d'Estaing's alleged compromising relations with Central Africa's deposed emperor Bokassa.

When he was arrested, Delpey was known to be working on a book based on a large sheaf of documents provided by Bokassa showing the French president's complex ties with the dictator, who was overthrown with the help of French forces after an international outcry over his part in the massacre of about 200 children in his country.

Copies of the documents were seized at Delpey's home and given to the French state security court, a closed-door tribunal with special jurisdiction originally created to deal with the French military rebellion against the granting of independence to Algeria.

Early this month, the newspaper Le Monde revealed that the court had illegally removed documents from the Delpey file relating to Bokassa's series of gifts of diamonds to Giscard and his family. The removal meant that in any trial the documents would not become part of the official record.

Just a week later, La Monde was indicted under a little-used statute for five articles written over three years critical of the administration of justice. One of the articles denounced Delpey's incarceration as a judicial scandal, and the most recent of the articles questioned the justification for the continued existence of the state security court.

The assault on France's most prestigious newspaper, whose editor-in-chief Jacques Fauvet and legal commentator Philippe Boucher risked six months' imprisonment if convicted, was immediately preceded by a speech by Giscard saying that in defense of France's system of justice, "the government will demonstrate . . . firmness every time it is necessary and toward whomever it is necessary."

Even normally progovernment newspapers denounced the indictment as attack on press freedom. The titular head of the Gaullist party, Giscard's nominal coalition partner, accused the government of "losing its cool."

There is widespread puzzlement about why Giscard chose to attack Le Monde and why he has now allowed Delpey to be released. The best explanation seems to be that Giscard, in preparation for next May's presidential elections, hopes to neutralize the newspaper's broad influence over the French establishment by depicting the journal as partisan and hostile.

Le Monde speculated that Delpey was freed now because Giscard did not want to have to wage a defensive reelection campaign on his civil liberties record. Other papers also speculated that the president wanted Delpey to have his way now in the hopes that it will be largely forgotten by election time.

It has been obvious for some time that other copies of the material Delpey was using were in safekeeping elsewhere and were likely to come out sooner or later. Delpey said upon his release that his book is finished and that he has no reason to hold it back. Bokassa must authorize the publication.

According to Delpey's lawyer, the highly respected Roland Dumas, the defendant was questioned very little while in prison, except soon after his arrest, when he was asked to admit that he intended to damage Giscard politically.

Delpey was arrested while coming out of Libyan mission in Paris. It was the fifth time in a short period that he had been observed by police visiting the diplomatic mission. When he was overthrown, Bokassa had been allying himself with Libya, apparently in response to being dropped by Giscard.

The prosecutor of the state security court said Delpey's release was now possible because the investigation is sufficiently advanced so that the defendant no longer can influence witnesses.

The French press has generally expressed doubt that there is a convincing case of espionage against Delpey. The law provides that it is up to Justice Minister Peyrefitte to set the date for the security court to hear the case.