Since taking over as Japan’s prime minister in December, Shinzo Abe and his conservative Liberal Democratic Party have been juggling a packed agenda of complicated issues, including reviving the country’s economy, coping with the aftermath of the 2011 earthquake and tsunami and managing prickly relations with neighbors like North Korea. Stirring up extraneous controversy is counterproductive, but that’s exactly what he and his nationalist allies in Parliament have done.

On Tuesday, a group of 168 mostly low-ranking conservative lawmakers visited the Yasukuni Shrine in central Tokyo, which honors Japan’s war dead, including several who were executed as war criminals after World War II. It was the largest mass visit by Parliament in recent memory. The Japanese news media said that Mr. Abe didn’t visit the shrine, instead sending a ritual offering, but his deputy prime minister and two other ministers made a pilgrimage there over the weekend. He has a record of defending Japan’s conduct during World War II.

Mr. Abe and his allies know well what a deeply sensitive issue this is for China and South Korea, which suffered under Japan’s 20th-century empire-building and militarism, and the reaction was predictable. On Monday, South Korea canceled a visit to Japan by its foreign minister and China publicly chastised Japan. On Tuesday, tensions were further fueled when Chinese and Japanese boats converged on disputed islands in the East China Sea.

Japan and China both need to work on a peaceful solution to their territorial issues. But it seems especially foolhardy for Japan to inflame hostilities with China and South Korea when all countries need to be working cooperatively to resolve the problems with North Korea and its nuclear program.