Shinzo Abe, Japan’s former prime minister, was gathering a crowd at a busy intersection in the western city of Nara on Friday morning when a large firework went off behind him. As Mr. Abe turned toward the rising cloud of white smoke, another shot rang out and he was hit twice in the chest and neck. The 67-year-old collapsed to the ground, where bystanders tried to revive him before he was rushed to an ambulance and then airlifted to a nearby hospital. A team of 20 doctors worked on him for more than five hours, but at around 5pm local time, Japan’s longest-serving prime minister, still a giant in the country’s political scene, was pronounced dead. The bullet that killed Mr. Abe was “deep enough to reach his heart” and doctors were unable to stop the bleeding, a spokesman for Nara Medical University Hospital told reporters. Police arrested Tetsuya Yamagami, a 41-year-old local man. Pictures from the scene showed Mr Yamagami holding a makeshift weapon before being tackled by Mr Abe’s security staff. Witnesses said he did not try to run away after the shooting. At a news conference on Friday night, Nara police said Mr Yamagami confessed to killing Mr Abe and was motivated by a “hatred of a certain group” he believed Mr Abe was associated with. They did not elaborate on a possible motive. Japanese leader Fumio Kishida said he was “simply speechless at the news of Abe’s death”. During an earlier news conference, a visibly emotional Mr Kishida had spoken of his hope that Mr Abe would pull through and said doctors were doing all they could for his former mentor. He called the attack “an act of brutality” and “absolutely inexcusable”. Mr Abe was killed for a candidate in Sunday’s upper house election, and while Mr Kishida and the ruling Liberal Democratic Party called off all events for Friday, the prime minister said campaigning would resume on Saturday. “Despite this tragedy, free and fair elections are a foundation of democracy and must be protected,” Mr Kishida said. Aki Abe, the former leader’s wife, had flown to Nara, near Osaka, to be by his side and was there when Mr Abe was pronounced dead. Gun violence is incredibly rare in Japan, where there are strict regulations on the ownership of firearms. Last year, only 10 gun-related incidents were reported, according to the country’s National Police Service. The police said the gun used in Friday’s attack was made by Mr Yamagami, a former member of the Japanese military. Photos from the scene showed a box-shaped gun with a pistol grip and two barrels covered in black tape. Witnesses described it as looking like a small “bazooka” and the shots produced a large amount of smoke and noise. A search of Mr Yamagami’s home turned up several additional improvised weapons, similar to the one allegedly used in the attack, which the police said was 43cm long and made of a mixture of materials such as metal and wood. While the use of such a weapon suggests a degree of planning by the alleged attacker, Mr Abe’s appearance in Nara was only confirmed last night, the local office of the ruling Liberal Democratic Party said. Kei Sato, the LDP candidate backed by Mr. Abe, shared news of the upcoming appearance on Facebook early Friday morning. Footage from Japan’s NHK broadcaster showed Mr Yamagami, dressed in beige trousers, a gray shirt and a white face mask, waiting for Mr Abe at the busy intersection in central Nara where he gave his speech. Mr Abe had been speaking for about 30 minutes when Mr Yamagami opened fire. The first shot missed the former prime minister, who turned towards the sound and was hit by a second volley. Mr Abe fell to the floor after the second shot, bleeding profusely, as Mr Yamagami was tackled by police. Politicians across the political spectrum expressed outrage at the attack on Friday. Kenda Izumi, leader of the opposition Constitutional Democratic Party, said the incident was “absolutely inexcusable”. Mr Abe’s successor as prime minister, Yoshihide Suga, called the attack “a cowardly act that rejects one of the foundations of democracy, the campaign”. Canadian Prime Minister Justin Trudeau called Mr Abe’s killing “incredibly shocking” and said he was “deeply saddened”. “The world has lost a great man of vision and Canada has lost a close friend,” Mr. Trudeau said. “My thoughts are with his wife, Aki, and the people of Japan as they mourn this loss. You will be missed, my friend.” US President Joe Biden praised Mr Abe as a “champion” of the US-Japan alliance and a bastion of democracy in East Asia. “This is a tragedy for Japan and for everyone who knew him. Gun violence always leaves a deep scar on the communities affected by it,” Mr. Biden said in a statement. First elected to parliament in 1993, Mr Abe became prime minister in 2006 but was forced to resign the following year due to ill health. He returned to the prime ministership in 2012, serving for eight years, the longest term of any Japanese prime minister. During that time, he transformed the Japanese economy and pursued an aggressive foreign policy, taking hard lines on North Korea and China and building a strong relationship with then-US President Donald Trump. Even after his retirement in 2020, again due to the chronic illness that ended his previous term as leader, Mr. Abe remained hugely influential in Japanese politics and in particular the LDP, head of the conservative party’s so-called “Abe faction.” . His immediate successor, Mr. Suga, who previously served as his cabinet secretary, struggled to match Mr. Abe’s popularity and resigned after just a year in office. Current Prime Minister Mr. Kishida is a protégé of Mr. Abe, but has put forth a number of policies that would break with “Abenomics.” A strong showing in Sunday’s election was seen as a potential opportunity for Mr Kishida to step out of his mentor’s shadow and exert greater control over the LDP. “Abe’s role has been so great for so long, even with his stints in the desert,” said Tobias Harris, author of The Iconoclast, a biography of the former leader, he tweeted. He said it was “hard to put into words how shocking” Friday’s shooting was. The Morning Update and Afternoon Update newsletters are written by Globe editors, giving you a concise summary of the day’s most important headlines. Sign up today.