MOSCOW — A bomb tore through a subway train in St. Petersburg on Monday afternoon, killing an estimated 10 people and injuring dozens more, government officials said.
The explosion occurred on a subway train traveling between the Technology Institute and Sennaya Square stations, according to the Investigative Committee, Russia’s federal criminal investigation agency. At the time of the attack, President Vladimir V. Putin was a few miles away in St. Petersburg, his hometown and the country’s second-largest city and former capital, on official business.
There was no immediate claim of responsibility, and Mr. Putin said all possibilities were being investigated.
The bomb, a homemade device filled with shrapnel, exploded in the third car just after the front of the train had entered the tunnel, Russian news outlets reported.
Ten people died — seven in the subway system, one while en route to a hospital and two while they were being admitted to an emergency room — and 39 others were injured, the health minister, Veronika Skvortsova, announced live on television. Some of the wounded included children, she said.
Another bomb was found at a nearby station, Vosstaniya Square, but was disarmed, a spokesman for the National Anti-Terrorism Committee, Andrei Przhezdomskiy, said on television. The subway system was shut after the attack, which occurred around 2:45 p.m. local time. The city announced that all surface public transportation would be free until further notice, and officials urged residents to remain vigilant.
“I appeal to you, citizens of St. Petersburg and guests of our city, to be alert, attentive and cautious, and to behave in a responsible manner in light of events,” Georgi S. Poltavchenko, the governor of St. Petersburg, said in a statement. As the old imperial capital, the city has the status of a federal governorate.
The governor declared a three-day period of mourning, starting on Tuesday.
The transit hubs in central St. Petersburg are normally crowded with passengers — the subway system carries two million passengers a day — but the explosion occurred before the evening rush hour.
Security was beefed up on the Moscow Metro and major airports after the blast. The entrances to all Moscow stations have metal detectors, leftover from the last such serious attacks seven years ago, but they have not been in use recently.
Mr. Putin, in a televised statement less than an hour after the explosion, said he had spoken with the leaders of the special services, including the Federal Security Service, and with law enforcement officials, who he said would “do everything to find out the causes of what had happened.”
Speaking from the Constantine Palace in the Strelna district of St. Petersburg, about 12 miles west of the blast, he added, “The government, both on the city and federal levels, will do everything to support families of the victims and injured.”
Images circulated on social media showing a damaged subway car and several people on a subway platform, apparently with injuries.
The Russian news media initially reported that there had been two explosions — one at the Technology Institute station and one at Sennaya Square. But by late afternoon that account was revised, saying there had been just one bombing, on a southbound train as it headed toward Technology Institute from Sennaya Square.
The two stations are adjacent on the No. 2 subway line, which runs north-south through the city. Both stations are transfer points with other subway lines. In the 19th century, the area around Sennaya Square was a notorious slum, depicted in Dostoyevsky’s “Crime and Punishment.”
Mikhail Syrovatskiy wrote on Vkontakte, a Russian social media network, that he had been traveling up the escalator at the Technology Institute station when a blast occurred, followed by urgent calls to evacuate the station and the arrival of ambulances and a helicopter. “Left metro just in time,” he wrote.
Mr. Syrovatskiy added, “I was standing on the escalator when some kind of noise started coming from below, then I heard the noise of the coming train.”
People started screaming, he added, and an announcement ordered passengers to disembark and evacuate. “Very soon a smell of burning started to be felt, but I didn’t see any smoke,” he said. “I didn’t see what was going on the platform itself. I think everyone thought this was a fire.”
Mr. Putin was in St. Petersburg for a meeting with the president of Belarus, Alexander G. Lukashenko, a traditional ally who has recently feuded with the Kremlin, and to give a speech at the All-Russia People’s Front, a political group started by the president.
In Washington, President Trump said the St. Petersburg bombing was a “terrible thing” that was “happening all over the world.”
Over the years, most terrorist attacks against domestic targets in Russia have been the work of Islamic insurgents, many of them fighters who fled Russia during a bloody crackdown across the Northern Caucasus. Thousands more joined the Islamic State, whose leadership has periodically threatened to carry out attacks in Russia in retaliation for Moscow’s bombing campaign in Syria.
Mr. Putin, in deploying the Russian military to Syria in September 2015, said the move was meant to take the fight to Islamic radicals before they brought it home. Once deployed, however, the Russians concentrated more on shoring up the government of President Bashar al-Assad than on attacking the Islamic State.
The Islamic State claimed responsibility in October 2015 for a bomb that brought down a Russian airliner after takeoff from Egypt, killing 224 people on board. In December 2013, weeks before the start of the Winter Olympics in Sochi, twin bombings at a train station and on a bus in the southern city of Volgograd killed more than 30 people. And in January 2011, a suicide attack at Domodedovo International Airport in Moscow killed more than three dozen people.
The last fatal attack on a subway system in Russia occurred in March 2010, when explosions at two stations in central Moscow killed at least 33 people. Investigators blamed two suicide bombers from the Dagestan region for those attacks; the leader of the Islamic insurgency in Chechnya, who has since been killed, claimed responsibility.
The subway system in Moscow was also twice struck in 2004 by deadly attacks. In February that year, a bomb detonated inside a train car as it left the Avtozavodskaya station in southeastern Moscow, killing at least 39 people; and that September, a suicide bomber detonated explosives at a station north of Moscow, killing nine.
An earlier version of this article misstated the year in which twin bombings took place in the city of Volgograd. They occurred in 2013, not 2012.