MOSCOW, JULY 8 -- Mathias Rust, the West German pilot imprisoned here after flying from Finland to Red Square in May, should be set free "within a few hours or a few days," Soviet spokesman Valentin Falin said today.

Rust's case was raised in talks between West German President Richard von Weizsaecker and Kremlin leader Mikhail Gorbachev, the highlight of a state visit marred slightly by the censorship of a von Weizsaecker speech by the Communist Party newspaper Pravda.

Von Weizsaecker's remarks challenging the division of East and West Germany and appeals for the human rights of ethnic Germans in the Soviet Union were among the nine sections of his Monday night speech cut from the version published in Tuesday's Pravda.

Also stricken was a quote from Karl Marx. Von Weizsaecker quoted Marx as saying, "No person opposes freedom; he at most opposes the freedom of others," and added, "But freedom is the freedom of people with other views."

At a time when the Soviet leadership is boasting of glasnost, or openness in Soviet society, and Moscow-Bonn relations are thawing out, the censorship of von Weizsaecker's remarks surprised western diplomats here and brought complaints from West German officials.

Falin, the director of the Novosti information service and former Soviet ambassador to West Germany, told journalists today that the passages had been left out "for technical reasons," and promised that further remarks by von Weizsaecker would be published in full.

A debate within the Soviet leadership about the publication of such speeches as von Weizsaecker's was under way, Falin said at a press conference.

Falin said that Rust, the West German teen-ager jailed here since his May 28 flight, would be set free "soon." Asked precisely when Rust would be released, he said, "Wait a few hours or a few days."

Von Weizsaecker confirmed in a press conference here today that he had raised Rust's case in a two-hour meeting with Gorbachev yesterday. But he fended off questions about the details of the Rust conversation.

Despite the censorship incident and strains over the Rust case, von Weizsaecker's visit has added fresh impulses to Soviet-West German relations, according to assessments on both sides.

Stressing that Bonn and Moscow had agreed a year ago to "open a new page" when West German Foreign Minister Hans-Dietrich Genscher came to Moscow, Gorbachev told von Weizsaecker yesterday that the page "still remains to be filled," according to the official Soviet news agency Tass.

Gorbachev is prepared to meet with West German Chancellor Helmut Kohl, von Weizsaecker said, calling for other measures to help put Bonn and Moscow on "a new long-term basis."

{In Bonn, officials told Reuter they expect Gorbachev to visit the West German capital within a year.}

"We both agreed {the talks} marked an important link in a chain that will be followed by further strong links," von Weizsaecker said in a press conference.

The fresh impulses in Soviet-German relations are expected to lead to increased business as well as political contacts, according to West German and Soviet officials here. Soviet Foreign Minister Eduard Shevardnadze is expected to visit Bonn in the fall, they said.

Arms control topics were prominent in both the von Weizsaecker-Gorbachev talks and a 3 1/2-hour meeting yesterday between Genscher and Shevardnadze, sources from both sides said.