was a general in the Imperial Japanese Army known for his work in Poland and his command of the Borneo Defence Army during World War II.

Born in Kōchi Prefecture, he joined the Imperial Japanese Army and graduated at the top of his class from the Imperial Japanese Army Academy in 1905 and the Army War College in 1914. While stationed overseas in Poland between 1919 and 1923, he aided the Polish independence movement and was decorated by the government of Poland. He was an important advocate of closer relations between Poland and Japan, and served in Poland again from 1934 to 1935. He was decommissioned in 1941.

Following the outbreak of World War II, he was recalled to active duty and assigned to lead the Borneo Defence Army, which was occupying the parts of Borneo that were seized from the British at the beginning of the war. He served in this capacity from 1942 to 1944, during which time he was promoted to general. In 1947, he was charged with war crimes by the Australian government due to his involvement in the killing of Australian POWs, but was acquitted. He lived in Tokyo after the war and died in 1974.

Early life, 1886–1919 Yamawaki Masataka was born on 2 March 1886 in Kanbara Village, which is today the city of Tosa, Kōchi Prefecture. He was the eldest son of a prominent local family who had served as samurai retainers to the Yamauchi clan of Tosa Domain during the Edo period (1600–1868). In grade school, Yamawaki was recognized as clever and studious, so he chose at age 14 to go to Hiroshima to attend military preparatory school. In 1904, he enrolled in the Imperial Japanese Army Academy and graduated the following year at the top of his class. For his academic performance, he received a silver watch from Emperor Meiji and was commissioned as a second lieutenant.

In 1911, he married Yasuoka Fumio, a local teacher, with whom he would have a son and two daughters. The marriage came purely from mutual love, which was contrary to the contemporary custom of marriages arranged by the parents.

The same year, he enrolled in the Army War College, graduating in 1914, again at the top of his class. Upon graduation, he was granted the honor of delivering a lecture in the presence of Emperor Taishō, where he discussed the lessons the Japanese Army could learn from the war that had recently broken out in Europe. After working at the Inspectorate General of Military Training, he was promoted to captain in 1916 and made a company commander.

He was an avid reader and soon gained a reputation as one of the army's top intellectuals. He was adept at diplomatic assignments, due to his modest and mild-mannered personality, as well as his knowledge of foreign languages. A skilled polyglot, he could speak fluently in German, French, Russian, and Polish. In January 1917, the army dispatched him to do research in Russia, where he stayed until he was expelled by the Soviet government.

Friend of Poland, 1919–1935 In January 1919, he was transferred to newly independent Poland. Yamawaki had a special interest in Poland as a potential ally against the Soviet Union and, upon his arrival in Warsaw, he forged close ties with Poland's political and military leadership. To aid them in their war with the Soviet Union, he gave them codebooks to assist in deciphering Soviet communications. He was an observer at the Battle of Warsaw, and was deeply impressed by Józef Piłsudski's leadership. Though not the first Japanese person to visit Poland, Yamawaki was the first to live there for an extended period.

While flying aboard a military aircraft with Polish officers, he was caught in a snowstorm near Gdańsk, causing the plane to break down and plunge into the frigid waters below. The Japanese Army was wired a report stating that Yamawaki had died. In fact, he was rescued soon after, but was the only survivor of the crash.

In 1921, Japan opened a legation in Warsaw, assigning him as its first military attaché. For his services to Poland, Piłsudski presented him on this occasion with the Virtuti Militari, Poland's highest military medal. For the rest of his career, Yamawaki was a strong advocate within the Japanese military of Polish interests. According to the historian Ewa Palasz-Rutkowska, he played a "crucial role" in establishing Japan's close relations with Poland during the interwar period. Immediately upon returning to Japan in 1923, Yamawaki persuaded his superiors to invite a Polish captain, Jan Kowalewski, to Japan to train Japanese officers in cryptography.

Between 1923 and 1925, he was a battalion commander in the 22nd Regiment. After, he served successively as an employee of the Imperial Japanese Army General Staff Office, instructor at the Army War College, and aide-de-camp to Field Marshal Uehara Yūsaku. He was also selected to take a specialized course in military intelligence at the Army War College. In 1929, he was promoted to colonel and appointed as chief of the General Staff's Organization and Mobilization Section, where his primary role was strategic planning against the Soviet Union. In this capacity, he was seen as a moderate who refused to align with any faction. He strongly opposed a proposal by various army officers to install a military dictatorship in the aftermath of the March incident, arguing instead that the army should request that the government enact gradual reforms aiming to curb political corruption.

In 1931, he was made commander of the 22nd Regiment, and next year was dispatched with the regiment to China to fight in the Shanghai Incident. After the war, he was made chief of the First Section of the Inspectorate General of Military Training, where he played a key role in writing the Red Book, a secret report on the state of the Soviet military. However, while he was traveling in Manchuria on the Chinese Eastern Railway, a copy of the report was stolen by a Soviet agent.

In 1934, he was brought back to Eastern Europe to serve as military attaché at the Japanese legations in Poland and Romania. Poland's leaders were excited to hear of his appointment, and requested that he wear his Virtuti Militari medal and greet a high-ranking government delegation when he arrived in Warsaw. Yamawaki had come to urge Poland to seek a military alliance with Germany and was thus later reputed in Japan to be the mastermind behind the Anti-Comintern Pact, an alliance signed in 1936 between Nazi Germany and Japan. In fact, he was wary of ties with Germany, and supported the efforts by Sugihara Chiune and Higuchi Kiichiro to help Jewish refugees fleeing the Nazis. In a letter to the Polish embassy, Yamawaki wrote:

I am a friend of Poland. When I talk with Germany, I constantly tell them to study Poland's history. It is not in Germany's interest to have Poland, which separates Germany from Russia, be Germany's enemy. Japan, in my opinion, could be a mediator and guarantor in Germany–Poland relations.

Administrative and overseas commands, 1935–1942 Upon returning from Poland in 1935, he worked at the Army Ministry, and was promoted to lieutenant general in 1937. In 1938, he became deputy army minister, serving under Army Minister Itagaki Seishirō. Yamawaki deeply respected Itagaki and worked closely with him. In this position, Yamawaki wrote an order requiring overseas military units to carefully censor the speech of soldiers returning from abroad. When a munitions depot exploded in Hirakata, killing nearly 100 people, he led a team that he had handpicked to meet personally the families of the victims to express his condolences and deliver compensation. In August 1939, Yamawaki and Itagaki attempted to prevent escalation of hostilities between Japan and the Soviet Union in Manchuria, but failed to prevent the Battle of Nomonhan, a major military defeat for Japan that led to both of their resignations.

In October 1939, Yamawaki was sent to China to command the 3rd Division, which was fighting in the Second Sino-Japanese War. He served with distinction in the Battle of Zaoyang–Yichang, where his leadership played a role in Japan's victory. In September 1940, he was transferred to Mengjiang to command the Mongolia Garrison Army, but was quickly incapacitated by malaria. He became so sick that the Army General Staff drafted his death certificate, and though he survived, he was forced to return to Japan to recuperate.

In April 1941, he became director of the Army War College. Despite formulating ambitious plans to reform the college, continued bouts of ill health soon compelled him to leave active duty and become a reservist. In retirement, he expressed concern about deteriorating US–Japan relations, and wrote a letter to Emperor Hirohito cautioning against war with the United States.

World War II and its aftermath, 1942–1951 In December 1941, Japan went to war with the Western powers, rapidly invading and conquering the island of Borneo. Japan formed the Borneo Defence Army to occupy North Borneo, Brunei, the Crown Colony of Labuan, and the Raj of Sarawak, which had been seized from the British. However, when the commander of the Borneo Defence Army, Maeda Toshinari, was killed in a plane crash, Yamawaki was recalled from the reserves to replace him in September 1942.

Yamawaki's plane landed at Sandakan Airport on 4 October, but the fighting on Borneo was already over by the time he arrived, so his mission was to run the occupation government. Its headquarters was initially at Kuching, though he later moved it to Kota Kinabalu. His main focus was the extraction of resources, especially petroleum, to fuel the Japanese war effort, and the construction of infrastructure, particularly a series of new airports. He had little knowledge of Borneo and relied heavily on his chief of staff, Manaki Takanobu, who had held the same position under Maeda.

Yamawaki's administration had mixed outcomes for the Borneo populace. On the one hand, local people greatly appreciated some of his programs, such as his efforts to help talented students study in Japan. One of the students he aided was Pengiran Muhammad Yusuf, who would later become prime minister of Brunei and felt a debt of gratitude to Yamawaki for the rest of his life. Yamawaki made alliances with tribal leaders, and attracted over 1,300 local recruits in 1944 to join a militia to assist in maintaining security.

On the other hand, Yamawaki was brutal in enforcing military law, requiring locals to do forced labor for the army and repressing dissent. Military tribunals that he authorized often handed down death sentences to both POWs and civilians. These actions caused the 1943 Jesselton revolt, a local resistance movement of guerrillas from diverse backgrounds. Yamawaki ordered the destruction of whole villages to defeat the rebellion, massacring over 400 people. An Australian investigation carried out after the war concluded that he had instituted a "general policy of extortion and oppression toward the native population".

The Borneo Defence Army operated the Sandakan camp, which held Australian POWs who had been captured at the Fall of Singapore. Under Yamawaki's guidance, POWs were forced to do hard labor, denied medicine, and routinely beaten by guards. He cut rations for the POWs to starvation levels in June 1944, resulting in hundreds of deaths. This was partly done in anticipation of food scarcity, but was also a deliberate move to weaken the POWs physically in case they attempted a rebellion once Allied soldiers landed on the island. One of his final orders before leaving his post was to approve a plan to relocate these POWs to Ranau, which would lead directly to the Sandakan Death Marches. Though these plans were not put into effect until after he left Borneo, he has been deemed the man most responsible for the death marches by both researcher Richard Wallace Braithwaite and historian Yuki Tanaka.