NARA, Japan - Shinzo Abe, Japan's longest-serving prime minister, was in grave condition on Friday after being shot while campaigning for a parliamentary election, with public broadcaster NHK saying a man with what appeared to be a homemade gun opened fired.

Prime Minister Fumio Kishida condemned the shooting in the western city of Nara in the "strongest terms".

Japanese people and world leaders expressed shock at the assassination attempt, an extremely rare attack in Japan that its political parties condemned.

Struggling to keep emotions in check, Kishida said Abe, 67, was in grave condition and the assault on him during the campaign for Sunday's upper house election was an unacceptable attack on the foundation of Japan's democracy.

"Everything that can be done is being done to revive him. I'm praying from the depths of my heart that his life will be saved," Kishida told reporters. He said he was not aware of any motive for the "absolutely unforgivable" attack.

A fire department official said earlier that Abe appeared to be in a state of cardiac arrest when airlifted to hospital.

Police said a 41-year-old man suspected of carrying out the shooting had been arrested. NHK quoted the suspect, identified as Tetsuya Yamagami, as telling police he was dissatisfied with Abe and wanted to kill him.

Abe was making a campaign speech outside a train station when two shots rang out at about 11:30 a.m. (0230 GMT). Security officials were then seen tackling a man in a grey T-shirt and beige trousers.

"There was a loud bang and then smoke," businessman Makoto Ichikawa, who was at the scene, told Reuters, adding that the gun was the size of a television camera.

"The first shot, no one knew what was going on, but after the second shot, what looked like special police tackled him."

RARE POLITICAL ATTACK

Kyodo published a photograph of Abe lying face-up on the street by a guardrail, blood on his white shirt. People were crowded around him, one administering heart massage.

Media reported that Abe was wounded in the chest and neck area. An official of Abe's faction of the ruling party said he was receiving transfusions, NHK said.

Political violence is rare in Japan, a country with strict gun regulations.

In 2007 the mayor of Nagasaki was shot and killed by a yakuza gangster. The head of the Japan Socialist Party was assassinated during a speech in 1960 by a right-wing youth with a samurai short sword.

Senior Japanese politicians are accompanied by armed security agents but often get close to the public, especially during political campaigns when they make roadside speeches and shake hands with passersby.

Airo Hino, political science professor at Waseda University, said such a shooting was unprecedented in Japan. "There has never been anything like this," he said.

Police said the suspected shooter was a resident of Nara. Media said he had served in Japan's military for three years until 2005.

Abe served two terms as prime minister, stepping down in 2020 citing ill health. But he has remained a dominant presence over the ruling Liberal Democratic Party (LDP), controlling one of its major factions.

Kishida, Abe's protege, had been hoping to use the election to emerge from Abe's shadow and define his premiership, analysts have said. Kishida suspended his election campaign after Abe's shooting.

'VERY, VERY SAD'

U.S. Secretary of State Antony Blinken expressed deep concern over Abe's condition.

"Our thoughts, our prayers are with him, with his family, with the people of Japan," Blinken said on the sidelines of a G20 meeting on the Indonesian island of Bali. "This is a very, very sad moment. And we're awaiting news from Japan."

The United States is Japan's most important ally.

The yen rose and Japan's Nikkei index fell on news of the shooting, partially driven by a knee-jerk flight to safety.

Abe is best known for his “Abenomics” policy of aggressive monetary easing and fiscal spending.

He also bolstered defence spending after years of declines and expanded the military’s ability to project power abroad.

In a historic shift in 2014, his government reinterpreted the postwar, pacifist constitution to allow troops to fight overseas for the first time since World War Two.

The following year, legislation ended a ban on exercising the right of collective self-defence, or defending a friendly country under attack.

Abe, however, did not achieve his long-held goal of revising the U.S.-drafted constitution by writing the Self-Defense Forces, as Japan’s military in known, into the pacifist Article 9.

Abe first took office in 2006 as Japan’s youngest prime minister since World War Two. After a year plagued by political scandals, voter outrage at lost pension records, and an election drubbing for his ruling party, Abe quit citing ill health.

He became prime minister again in 2012.

Abe hails from a wealthy political family that included a foreign minister father and a grandfather who served as premier.

(Reporting by Satoshi Sugiyama in Nara, Chang-Ran Kim in Tokyo; Additional reporting by Reuters staff; Writing by Robert Birsel; Editing by Christian Schmollinger and William Mallard)