MOSCOW — Sitting behind closed doors, a Moscow court on Tuesday extended the detention of Evan Gershkovich, a Wall Street Journal correspondent accused of espionage, for more than three months, until August 30.

The denial of bail and the extension of Gershkovich’s detention were widely expected, although Russia has not provided any evidence to support the espionage charge. The US government and The Wall Street Journal have vehemently denied the allegations, saying that “reporting is not a crime.”

Mr. Gershkovich’s parents, Ella Milman and Mikhail Gershkovich, waited for more than an hour outside the courtroom before being allowed into the hearing. It was their first sight of their son since his arrest on March 29.

Afterwards, they were taken away in the company of one of Mr. Gershkovich’s lawyers. They did not comment on what they saw. Milman wore a “Free Evan” button. Before entering the hearing, Gershkovich’s father said, “We hope that he is doing well and that he can be as strong as his mother.”

Mr. Gershkovich, 31, has been detained in the prison in Lefortovo since he was arrested on March 29 during a reporting trip to the central Russian city of Yekaterinburg. If convicted, Gershkovich could face up to 20 years in a Russian penal colony.

A prisoner exchange, like the one that secured the release of Brittney Griner, an American basketball star, late last year, would not take place until after a verdict in the case, Russian officials have said. Mrs. Griner was jailed for nearly 10 months on a cannabis possession charge. However, it is known that the Biden administration is working to secure an early release for Gershkovich.

The US government, The Wall Street Journal, numerous colleagues, press freedom groups and prominent international officials have all condemned Gershkovich’s detention, calling the charges against him completely baseless.

The Journal said in a statement after the hearing that while “we expected there would be no change to Evans’ wrongful detention, we are deeply disappointed.”

“The charges are demonstrably false, and we continue to demand his immediate release,” it said.

A handful of journalists were allowed into the courthouse but not the courtroom itself. Mr Gershkovich was hidden from view as he entered and exited, before being driven back to Lefortovo prison in a white van with tinted windows.

US diplomats had said it was almost certain that Gershkovich’s detention would be extended at the hearing and his bail application was rejected. Even in the best of times, a preliminary investigation into an espionage case normally takes months, and a verdict can take up to a year.

Russian-American relations are in a state of acute tension over the war in Ukraine, a conflict still officially referred to in Russia as a “special military operation,” and President Vladimir V. Putin has launched an effort to suppress independent news outlets and free speech in public.

In Russia, the word “war” has come to be used increasingly, but not to describe the invasion of Ukraine that Putin ordered early last year. Rather, it is used to characterize a broad confrontation with the West — the United States, NATO and the European Union — from which, in the prevailing Russian view, there is no turning back.

“Russia has entered a phase of the most acute confrontation with the collective West,” Sergey V. Lavrov, the Russian foreign minister, said last week.

Dmitry. A. Medvedev, the former Russian president who has become increasingly outspoken in his nationalist outbursts, said on Tuesday that “the more destructive weapons delivered to Kiev are, the more likely the scenario of a nuclear apocalypse.”

Before Gershkovich’s arrest, Russia had not charged a Western journalist with espionage since the Cold War. On a hearing in a Moscow courtroom on April 18, reporters were allowed inside and saw Mr. Gershkovich standing in a glass cage with red handcuff marks visible on his wrists. He flashed a smile and explained through his lawyer his determination to defend his right to work freely as an accredited journalist.

Lefortovo prison is notorious for the close isolation and often harsh conditions imposed on its inmates. Mr. Gershkovich has been generally isolated, the diplomats said, but his lawyers have been allowed to see him regularly.

The US ambassador to Russia, Lynne M. Tracy, was allowed to visit Gershkovich on April 17, under intense Russian scrutiny. The Russian authorities have refused two requests for consular access since then.

Russia has linked this refusal to the denial of US visas last month to Russian journalists who wanted to accompany Mr Lavrov, the foreign minister, to New York.

The denial of consular access appears to violate both a bilateral treaty between the United States and Russia and the Vienna Convention on Consular Relations. After a long wait, two US consular officials were allowed into the courtroom at the same time as Gershkovich’s parents on Tuesday. Like his parents, they left without comment.

Dmitri S. Peskov, Putin’s spokesman, has said Gershkovich was arrested “in the act,” but has not elaborated. Russia has offered no evidence to support the espionage charge against a journalist, the son of Soviet émigrés, whose work reflected a deep knowledge of the country.

The case, a shock to all accredited foreign correspondents in Moscow, most of whom have now left, has contributed to the sharp deterioration in relations between Russia and the United States. Mr. Putin’s regime had hardened its repressive rule for many years, largely eliminating political alternatives and cultivating a climate of fear. It has accelerated that process under the pressure of the conflict in Ukraine.

Mr. Putin has not hesitated to stifle criticism of the war by making it punishable by long prison sentences. His intrusion has led to an exodus of critics of the war and many Russians worried about, or horrified by, the direction of their country.

Earlier this year, a Moscow court sentenced Vladimir Kara-Murza, a Kremlin critic and Washington Post writer, to 25 years in prison, one of a string of harsh sentences that have made clear how dangerous it can be in Russia today to speak one’s mind .

Matt Miller, a spokesman for the US State Department, told reporters in Washington on Tuesday that the US government did not arrange travel for Gershkovich’s parents to attend his hearing. He added that while he could only imagine their pain and their desire to see their son, the United States advises all Americans to avoid traveling to Russia.

The Biden administration has argued that Gershkovich is “wrongfully imprisoned” — an official decision that effectively says the United States views him as a political hostage and opens the way for a wide range of steps to secure his release. The White House has called for his immediate release.

The hearing took place in an almost surreal Moscow in its purring prosperity, where several billboards appealing for recruits to join the Russian armed forces are almost the only sign of the war being fought in Ukraine. The conflict has, according to American estimates, caused more than 200,000 Russians to be killed or injured.

Michael Crowley contributed reporting from Washington.