This question originally appeared on Quora.

Answer by Harold Kingsberg:

The short version: Japan’s actions from 1852 to 1945 were motivated by a deep desire to avoid the fate of 19th-century China and to become a great power.

For Japan, World War II grew from a conflict historians call the Second Sino-Japanese War. The Second Sino-Japanese War began in earnest in 1937 with a battle called the Marco Polo Bridge Incident. However, before this, there had been years of border clashes between the Japanese and the Chinese, having started with the 1931 Japanese invasion of Manchuria. So, to explain Japan’s behavior in the years from 1941 to 1945, we have to explain why Japan invaded Manchuria in 1931, and in order to do this, we have to go back to 1853.

Before 1852, Japan was isolationist. Contact with the West was limited to trade with the Dutch in the city of Nagasaki—Westerners otherwise weren’t allowed in the country, and Western influences were strongly discouraged. In 1853, Commodore Matthew C. Perry of the United States Navy steamed into what we now call Tokyo Bay. The Japanese told him to leave and go to Nagasaki. He ignored the directive and was surrounded by the Japanese fleet. He presented a counterdemand to have a letter from U.S. President Millard Fillmore presented to the de facto ruler of Japan at the time, the shogun. When this demand was not met, he shelled a few buildings in the harbor. The letter was presented. Perry returned a year later to sign the Convention of Kanagawa, a treaty that opened the Japanese ports of Shimoda (a city between Kyoto and what we now call Tokyo and was then called Edo) and Hakodate (located on the northern island of Hokkaido) to U.S. trade. The terms were dictated by the Americans, and the Japanese had little choice but to agree, seeing that they were seriously technologically outmatched.

This is where modern Japanese history begins. The importance of Perry’s missions to Japan in the 1850s really can’t be overstated. While Japan had previously thought itself to be a strong country, Perry’s actions and the signing of treaties widely viewed in Japan as unequal destroyed this image. While Japan’s isolation had allowed the Japanese to think that they might escape the fate the Chinese were suffering, the end of this isolation gave lie to that idea.

The Japanese were petrified that they’d go the same way China did, and it wasn’t very long before a reform movement got started. In 1868, this reform movement led to what we now call the Meiji Restoration. The shogun was stripped of his power, which was then nominally placed back in the hands of the emperor but really into the hands of his advisers. In a very brief span of time, the feudal system that had governed Japanese society for centuries was abolished, the military was reformed, and the country was put on the path to industrialization.

The Japanese knew they had to catch up to the Western powers or else risk getting stomped flat by them, which is what had happened to China, so they did a lot of imitation. Western-style dress was widely adopted among the elites of the new society, the military was recreated along Clausewitzian lines, the parliament was something of a ripoff of the Prussian one, and so on.

The thing is that if you’re trying to imitate a 19th-century European power, you have to engage in imperialism—not engaging in colonialism made a country at the time look weak. In the case of 19th-century Japan, the obvious target for imperialism was just across the Sea of Japan: Korea. By the 1890s, Korea was actually seen as a massive liability for Japan: It had not reformed as Japan had, and unlike China, it could feasibly be conquered by an interested Western nation, which would have given an excellent staging ground for an invasion of Japan. Additionally, the Korean peninsula is rich in iron and coal, which you need if you’re a rapidly industrializing country in the 19th-century. Because Japan is not particularly rich in natural resources, it was advantageous for it to have colonies. It wasn’t so advantageous for the colonized, but then again, colonialism isn’t designed for that anyway.

The problem was that Korea was a Chinese tributary state: The Korean king paid tribute to the Chinese emperor. While the Japanese could, and did, force the Koreans to sign some unequal treaties, the peninsula remained free of the Japanese. However, in 1894, China sent troops into Korea to help put down a rebellion, not notifying the Japanese before it did so. This was against a previous treaty, so the Japanese also sent in troops. Unsurprisingly, fighting broke out, leading to the First Sino-Japanese War from 1894-1895.

The Chinese lost the war, and they lost it badly. With the Treaty of Shimonoseki, Korea stopped paying tribute to China and effectively became a Japanese tributary state. The Japanese also gained the island of Taiwan as a colony, along with reparations and trading rights in several Chinese cities, the likes of which had really only been previously extended to Western nations. Additionally, the Japanese gained the Liaodong Peninsula, from which several Western powers forced it to withdraw. Not that the Chinese were allowed to hold onto the Liaodong Peninsula either—the Russians leased it. This was the start of Japan’s colonial empire, along with a rivalry with the Russians for influence in Korea and Manchuria.

This rivalry ended up leading to the 1904-1905 Russo-Japanese War. The Japanese emerged victorious from this conflict and were consequently seen as a great power. The Japanese walked away with the Liaodong Peninsula lease—formally, the Kwantung Leased Territory—along with substantial rights in Manchuria, most notably control over Manchuria’s railroads. After the war, Japan officially made Korea a protectorate in 1905—Russia was in no position to contest that action—and subsequently annexed Korea in 1910.

In World War I, Japan entered on the side of the Allied Powers and picked off Germany’s colonial empire in the Pacific Ocean. This was probably the high-water mark of Japan’s acceptance by the Western powers prior to 1945. And to this point, Japan had really acted exactly as the various European colonial powers had.

However, during the interwar period, aggressively expansionist moves, though far from unheard of, started leaving sour tastes in the mouths of many nations. It wasn’t simply a matter of geopolitics, either—most people in Europe really did not want another war, and those countries that seemed to be provoking said wars were given the stink eye. Because Japan hadn’t suffered in the war the way that, say, France and Belgium had, the reluctance to engage in brinkmanship simply wasn’t instilled the same way.

Also in the interwar period, the Republic of China started getting it together. While the country had effectively collapsed into a patchwork of feuding warlords in the 1910s, the Kuomintang managed to get most of the south unified under its government before embarking on what is now called the Northern Expedition from 1926 to 1928. This also brought the north of the country under the control of the Nationalist government, which was set up in the city of Nanjing. Nationalist China still had issues, warlords among them, but by 1928 it was a much stronger state.

Japan viewed China’s steps toward reversing the damage of the previous century as a threat to its control of Manchuria’s railroads and of the Kwantung Leased Territory. Losing anything to China was seen as unacceptable, because of course the Japanese had spent the last 50 years desperately trying to avoid being China. To that end, in 1931, the Japanese invaded Manchuria to protect their interests in the railroad and the Kwantung Leased Territory. Japan subsequently set up a puppet state, Manchukuo, which nobody else recognized as a legitimate state. This isolated Japan, and it also meant a continuing series of border clashes with the Chinese. Eventually, in 1937, the Japanese provoked the Chinese into full-scale war with the Marco Polo Bridge Incident.

Had the Second Sino-Japanese War been a short one, the Japanese might have walked away with a result similar to the First Sino-Japanese War: a hugely favorable treaty and some land cessions. However, the Nationalist government didn’t give in so quick and would not agree to a negotiated peace with the sort of terms the Japanese government required to stave off a revolution.

To put it simply, the war pushed the Japanese economy and military to the limit. Japan’s supplies of rubber, iron, and oil were pushed to the breaking point, and it didn’t have any allies in the region. Increasingly, the view in the international community was that it was a rogue state, which did not help it procure the materials needed to keep prosecuting the war in China. An attack on a U.S. gunboat on the Yangtze River alienated the U.S., as did widespread Japanese atrocities against the Chinese civilian population. Eventually, this led to embargoes on trade with Japan.

At which point, Japan was in a fix. It had assembled a colonial empire both to enable Western-style industrialization and also to establish credibility as a great power. However, because World War I hadn’t affected Japan in anything approximating the same way it had Europe, its continued actions in what would in the U.S. and Europe be considered the prewar vein actually started making the country lose the respect it had overhauled itself to gain. A Japanese diplomat put it as follows: “The West taught Japan poker, but after winning all the chips, declared the game immoral.” And while it’s true that the Western powers hadn’t perpetrated anything along the lines of the Rape of Nanking, well, look up Congo Free State, and you’ll find their hands were far from clean.

Japan desperately needed resources, and there were only two places to get them: Siberia and the South Pacific. The Imperial Japanese Army favored going after Siberia but were forced to abandon that strategy after the disastrous 1939 Battle of Khalkhin Gol. The Imperial Japanese Navy got its way, but it had to deal the fact that the South Pacific had already been colonized. Hence the simultaneous attacks on Pearl Harbor, Singapore, Hong Kong, the Philippines, and Malaya: The Japanese didn’t want the Americans or the British to resist the Japanese scramble for rubber and oil. This turned out to be suicidal and a complete misreading of how the Americans would react to Pearl Harbor, but it was about 90 years in the making.

More questions on Quora: