Peter Parks / AFP / Getty Images Riot police stand firm against anti-Japan protesters in the Chinese city of Shenzhen on Sept. 18, 2012

U.S. Secretary of Defense Leon Panetta certainly picked a sensitive date for his visit to China. Sept. 18 is the anniversary of the 1931 Mukden Incident, when imperial Japan used a railway bomb its soldiers planted in Manchuria to stage an invasion and make way for its brutal wartime occupation of China.

That catalyzing moment in history, known after its date as the 918 incident in China, would not seem to affect the Americans too much today, except that China and Japan’s relations have been rocked by a territorial dispute that has dragged relations to their lowest point in years. Over the past few days, there have been anti-Japanese protests in numerous Chinese cities, with thousands of angry citizens hurling bottles and eggs at the Japanese embassy in Beijing and regional Japanese consulates. Japanese-brand cars have been torched and some Japanese-owned factories in China forced closed.

(PHOTOS: Anti-Japan Protests Hit China’s Capital)

In a police state where security forces almost never allow protests of this magnitude to coalesce, the streets of China seethed with patriotic fervor, as citizens relished the rare chance to express themselves publicly. “I hope there’s a war between China and Japan,” said Zhang Tihai, a retired farmer, as thousands of Chinese marched past the Japanese embassy in Beijing on the 81st anniversary of the Mukden Incident. “That will settle things once and for all.” Near the embassy, riot police and other security forces lined a normally busy stretch of road more than 2 km long, doing nothing to dissuade the protesters from marching. “Support the army, kill Japanese,” blared one protest banner, while another urged, “Take over Tokyo, kill Yoshihiko Noda,” referring to the Japanese Prime Minister. Some ralliers held aloft portraits of Chairman Mao Zedong, who fought the occupying Japanese and later founded the People’s Republic in 1949.

The current conflict centers on a scattering of uninhabited islets in resource-rich waters that the Chinese call the Diaoyu and the Japanese label the Senkaku. (Taiwan also claims the islands.) Earlier this month, after Tokyo’s fiery nationalist governor Shintaro Ishihara threatened to buy some of the islands from its private owner, the Japanese government announced it would nationalize the specks of land instead. If Tokyo hoped that move would calm tensions between Asia’s two biggest economies, it was either being naive or disingenuous. Japan is facing an election in the coming months; looking weak on China isn’t going to win any votes.

In the short term, though, it’s the Chinese leadership that appears to have capitalized most on the island dispute. With a once-a-decade leadership transition set to begin soon, Beijing has been gifted the perfect diversion from the sensitive power handover. The upcoming leadership change will inevitably raise questions in China about how far the country has come — and, more important, how far it still has to go, at a time when the domestic economy is slowing and politics still remain the preserve of a corruption-plagued Chinese Communist Party. “Japan’s behavior over the Diaoyu Islands issue is a brazen negation of the fruits of the victory in the global war against fascism,” fulminated the People’s Daily, the Chinese government’s mouthpiece. Serious problems closer to home have been conveniently ignored in the state press, as was the mysterious two-week disappearance of Vice President Xi Jinping from the public eye earlier this month.

(PHOTOS: China: Island Dispute Spurs Anti-Japan Protests)

Enter Leon Panetta. The U.S., of course, happens to be Japan’s ally. Since the end of World War II, Washington has promised to defend Japan in the event of any armed conflict. Prior to landing in Beijing on Tuesday, the U.S. Secretary of Defense visited Japan, where he reassured Tokyo of Washington’s commitment to its treaty obligations. (After Japan’s defeat in World War II, the U.S. forced its erstwhile enemy to give up ambitions of developing a normal military force, lest an imperial Japan again threaten the Pacific.)

Last year, President Barack Obama pledged to pivot U.S. foreign policy toward Asia, a shift designed to recognize the economic ascendancy of the world’s most populous continent. But the move was also viewed as an effort to contain a rising— and a more militarily assertive — China. During the Secretary of Defense’s visit to Japan, he unveiled plans for the two countries to develop a second missile-defense system for the island nation, which worries about a threat from a nuclear North Korea backed by the Chinese. The announcement of this joint U.S.-Japan radar shield naturally didn’t please Beijing.

At the start of his Asia trip, Panetta warned of how quickly regional territorial tensions could blaze out of control. (China is also sparring with maritime neighbors, like Vietnam and the Philippines, over disputed shoals and islands in the South China Sea.) “A misjudgment on one side or the other could result in violence, and could result in conflict,” Panetta said. By the time he arrived in Beijing, the U.S. Secretary of Defense was urging cooler heads to prevail: “With respect to these current tensions, we are urging calm and restraint by all sides and encourage them to maintain open channels of communication in order to resolve these disputes diplomatically and peacefully.”

(MORE: Tensions with Japan Increase as China Sends Patrol Boats to Disputed Islands)

But some of the thousands of protesters at the Japanese embassy in Beijing on Tuesday made their displeasure at Japan and its security alliance partner very clear. Cooler heads were not in evidence. “F— Japan,” one Chinese university student, who gave his name as Kevin, yelled in English. “F— America. Declare war on Japan. Declare war on America.” Chinese flags waved, images of Chairman Mao loomed.

Meanwhile, a pair of Japanese chose Tuesday to briefly land on one of the disputed islets, a display of nationalist showmanship that immediately aroused further indignation in China. “The unlawful landing of the Japanese right-wingers on the Chinese territory of the Diaoyu Islands was a gravely provocative action violating Chinese territorial sovereignty,” said Chinese Foreign Ministry spokesman Hong Lei.

At the same time, the Chinese media reported that 1,000 Chinese fishing boats were rushing to waters near the islands in what is surely an officially coordinated maneuver. It’s instructive to look back two years ago, when the Japanese coast guard detained for 10 days the skipper of a Chinese fishing boat that rammed a Japanese coast-guard vessel in disputed waters. You’d think that such an incident might have inflamed a Chinese public primed by a domestic education system that heaps hate on the Japanese wartime aggressors. But although some protests occurred back then, the decibel level of anger was far lower than it is today. Beijing’s leaders have chosen to allow today’s anti-Japan demonstrations to ignite, and the world’s three biggest economies — the U.S., China and Japan — may be the victims of further explosive fury.

— With reporting by Chengcheng Jiang / Beijing

MORE: Japan Frets over U.S. Support in China Dispute