In mid-1940, Nazi Germany rapidly defeated the French Third Republic, and the colonial administration of French Indochina (modern-day Vietnam, Laos and Cambodia) passed to the French State (Vichy France). Many concessions were granted to the Empire of Japan, such as the use of ports, airfields, and railroads. Japanese troops first entered parts of Indochina in September 1940, and by July 1941 Japan had extended its control over the whole of French Indochina. The United States, concerned by Japanese expansion, started putting embargoes on exports of steel and oil to Japan from July 1940. The desire to escape these embargoes and to become self-sufficient in resources ultimately contributed to Japan's decision to attack on 7 December 1941, the British Empire (in Hong Kong and Malaya) and simultaneously the United States (in the Philippines and at Pearl Harbor, Hawaii). This led to the United States declaring war against Japan on 8 December 1941. The United States then joined the side of the British Empire, at war with Germany since 1939, and its existing allies in the fight against the Axis powers.
Indochinese communists had set up a covert headquarters in Cao Bằng Province in 1941, but most of the Vietnamese resistance to Japan, France, or both, including both communist and non-communist groups, remained based over the border, in China. As part of their opposition to Japanese expansion, the Chinese had fostered the formation of a Vietnamese nationalist resistance movement, the Dong Minh Hoi (DMH), in Nanking in 1935/1936; this included communists, but was not controlled by them. This did not provide the desired results, so the Chinese Communist Party sent Ho Chi Minh to Vietnam in 1941 to lead an underground centered on the communist Viet Minh. Ho was the senior Comintern agent in Southeast Asia, and was in China as an advisor to the Chinese communist armed forces. This mission was assisted by European intelligence agencies, and later the US Office of Strategic Services (OSS). Free French intelligence also tried to affect developments in the Vichy-Japanese collaboration.
In March 1945, the Japanese imprisoned the French administrators and took direct control of Vietnam until the end of the war. At that point, Vietnamese nationalists under the Viet Minh banner took control in the August Revolution, and issued a Proclamation of Independence of the Democratic Republic of Vietnam, but France took back control of the country in 1945–1946.

In looking at the broad picture of Southeast Asia at the end of World War II, the different political philosophies of the major actors clashed, including:
The anti-communist Western powers, which viewed the French as the protector of the area from communist expansion.
The nationalist and anti-colonialist movements that wanted independence from the French.

The communists, both local and foreign, who sought to expand their influence
The lines between these movements were not always clear, and some alliances were of convenience. Prior to his death in 1945, Franklin D. Roosevelt made several comments about not wanting the French to regain control of Indochina.
Pre-war events
1936
In France itself, an anti-fascist Popular Front, included the center, Left, and Communists, stated a new policy for all French colonies, not just Indochina. A corresponding Indochinese Democratic Front formed.

An unpopular Governor General was replaced, encouraging Vietnamese nationalists to meet a French commission of Inquiry with lists of grievances. By the time the commission arrived, however, the Leftists were now not just members of an opposition, but part of a government concerned about Japanese expansion. Socialist Minister for the Colonies Marius Moutet, in September, sent a message to French officials in Saigon, "You will maintain public order...the improvement of the political and economic situation is our preoccupation but...French order must reign in Indochina as elsewhere." Moutet's Popular Front failed in actually liberalizing the situation, and he was to be involved in a greater failure a decade later.
1937
Throughout East and Southeast Asia, tensions had been building between 1937 and 1941, as Japan expanded into China. Franklin D. Roosevelt regarded this as an infringement on U.S. interests in China. The U.S. had already accepted an apology and indemnity for the Japanese bombing of the USS Panay, a gunboat on the Yangtze River in China.
1938
The French Popular Front fell, and the Indochinese Democratic Front went underground. When a new French government, still under the Third Republic, formed in August 1938, among its principal concerns were security of metropolitan France as well as its empire.

Among its first acts was to name General Georges Catroux governor general of Indochina. He was the first military governor general since French civilian rule had begun in 1879, following the conquest starting in 1858, reflecting the single greatest concern of the new government: defense of the homeland and the defense of the empire. Catroux's immediate concern was with Japan, who were actively fighting in nearby China.
1939
Both the French and Indochinese Communist parties were outlawed.
World War II
1940
After the defeat of France, with an armistice on 22 June 1940, roughly two-thirds of the country was put under direct German military control. The remaining part of southeast France and the French colonies were under a nominally independent government, headed by World War I hero Marshal Philippe Pétain. Japan, not yet allied with Germany until the signing of the Tripartite Pact in September 1940, asked for German help in stopping supplies going through Indochina to China.

Increased Axis pressure
General Catroux, who had first asked for British support and had no source of military assistance from outside France, stopped the trade to China to avoid further provoking the Japanese. A Japanese verification group, headed by Issaku Nishimura entered Indochina on 25 June.
On the same day that Nishimura arrived, Vichy dismissed Catroux, for independent foreign contact. He was replaced by
Vice Admiral Jean Decoux, who commanded the French naval forces in the Far East, and was based in Saigon. Decoux and Catroux were in general agreement about policy, and considered managing Nishimura the first priority. Decoux had additional worries. The senior British admiral in the area, on the way from Hong Kong to Singapore, visited Decoux and told him that he might be ordered to sink Decoux's flagship, with the implicit suggestion that Decoux could save his ships by taking them to Singapore, which appalled Decoux. While the British had not yet attacked French ships that would not go to the side of the Allies, that would happen at Mers-el-Kébir in North Africa within two weeks; it is not known if that was suggested to, or suspected by, Decoux. Deliberately delaying, Decoux did not arrive in Hanoi until 20 July, while Catroux stalled Nishimura on basing negotiations, also asking for U.S. help.
Reacting to the initial Japanese presence in Indochina, on 5 July, the U.S. Congress passed the Export Control Act, banning the shipment of aircraft parts and key minerals and chemicals to Japan, which was followed three weeks later by restrictions on the shipment of petroleum products and scrap metal as well.
Decoux, on 30 August, managed to get an agreement between the French Ambassador in Tokyo and the Japanese Foreign Minister, promising to respect Indochinese integrity in return for cooperation against China. Nishimura, on 20 September, gave Decoux an ultimatum: agree to the basing, or the 5th Division, known to be at the border, would enter.
Japan entered Indochina on 22 September 1940. An agreement was signed, and promptly violated, in which Japan promised to station no more than 6,000 troops in Indochina, and never have more than 25,000 transiting the colony. Rights were given for three airfields, with all other Japanese forces forbidden to enter Indochina without Vichy consent. Immediately after the signing, a group of Japanese officers, in a form of insubordination not uncommon in the Japanese military, attacked the border post of Đồng Đăng, laid siege to Lạng Sơn, which, four days later, surrendered. There had been 40 killed, but 1,096 troops had deserted.
With the signing of the Tripartite Pact on 27 September 1940, creating the Axis of Germany, Japan, and Italy, Decoux had new grounds for worry: the Germans could pressure the homeland to support their ally, Japan.
Japan apologized for the Lạng Sơn incident on 5 October. Decoux relieved the senior commanders he believed should have anticipated the attack, but also gave orders to hunt down the Lạng Sơn deserters, as well as Viet Minh who had entered Indochina while the French seemed preoccupied with Japan.
Through much of the war, the French colonial government had largely stayed in place, albeit as Japan's puppets, as the Vichy government was on reasonably friendly terms with Japan. Japan had not entered southern Indochina until 1941, so the conflicts from 1939 to the fall of France had little impact on a colony such as Indochina. The Japanese permitted the French to put down nationalist rebellions in 1940.
1941
In July 1941, Japan successfully pressured the Vichy government into allowing the presence of their armed forces in Indochina. This was met with alarm by the United States, not only because it showed that the Japanese were willing to occupy other nations' colonial possessions in Asia, but also because Indochina had remained an important source of rubber and tin for the United States. Sumner Welles reported that President Roosevelt sought a compromise with the Japanese "to regard Indochina as a neutralized country the same way Switzerland had up to now by the powers as a neutralized country..." This suggestion was relayed to Kichisaburō Nomura, but was either not forwarded to Japanese leadership, or not considered before the outbreak of the Pacific War. When the Pacific War started Japan used Indochina a springboard to attack Malaya and the Philippines, and the Dutch East Indies.
Birth of the Việt Minh
In February 1941, Hồ Chí Minh returned to Vietnam and established his base in a cave at Pắc Bó in Cao Bằng Province, near the Sino-Vietnamese border. In May, the Indochinese Communist Party convened its eighth plenum where it placed nationalist goals ahead of communist goals: it prioritized the independence of Vietnam ahead of leading the communist revolution, fomenting class war, or aiding the workers. To that end, the plenum established the "League for the Independence of Vietnam" (Viet Nam Độc lập Đồng minh hội, Việt Minh for short). All Vietnamese political groups were welcomed to join the Viet Minh provided they supported ICP-led action against the Japanese and French colonizers. Hồ Chí Minh's greatest accomplishment during this period was unifying urban nationalist groups with his own peasant communist rebels and creating a single anti-colonial independence movement.
Vichy agreements with Japan about Indochina
Vichy France signed the Protocol Concerning Joint Defense and Joint Military Cooperation on 29 July. This agreement defined the Franco-Japanese relationship for Indochina, until the Japanese abrogated it in March 1945. It gave the Japanese a total of eight airfields, allowed them to have more troops present, and to use the Indochinese financial system, in return for a fragile French autonomy. In December, 24,000 Japanese troops sailed from Vietnam to Malaya.
1942
The Chinese organized the Đồng minh hội (ĐMH) coalition to gain intelligence from Indochina, a coalition dominated by the VNQDĐ. The only actual assets in Indochina, however, were Việt Minh.
During the Japanese occupation, even during French administration, the Việt Minh exiled to China had an opportunity to quietly rebuild their infrastructure. They had been strongest in Tonkin, the northern region, so moving south from China was straightforward. They had a concept of establishing "base areas" (chiến khu) or "safe areas" (an toàn khu) in the often mountainous jungle. Of these areas, the "homeland" of the VM was near Bắc Kạn Province. (see map)
Additional chiến khu developed in Yên Bái Province, Thái Nguyên Province (the "traditional" stronghold of the PCI), Pắc Bó in Cao Bằng Province, Ninh Bình Province and Đông Triều in Quảng Ninh Province. As with many other revolutionary movements, part of building their base was providing "shadow government" services. They attacked landlords and moneylenders, as well as providing various useful services. They offered education, which contained substantial amounts of political indoctrination.
They collected taxes, often in the form of food supplies, intelligence on enemy movement, and service as laborers rather than in money. They formed local militias, which provided trained individuals, but they were certainly willing to use violence against reluctant villagers. Gradually, they moved this system south, although not obtaining as much local support in Annam, and especially Cochinchina. While later organizations would operate from Cambodia into the regions of South Vietnam that corresponded to Cochin-China, this was well in the future.
Some of their most important sympathizers included educated civil servants and soldiers, who provided clandestine human-source intelligence from their workplaces, as well as providing counterintelligence on French and Japanese plans.
In August, while on a trip in southern China to meet with Chinese Communist Party officials, Hồ was arrested by the Kuomintang for two years.
1943
To make the Dong Minh Hoi an effective intelligence operation, the Chinese released Ho and put him in charge, replacing the previously Kuomintang-affiliated Vietnamese nationalists.
1944
In 1944, Ho, then in China, had requested a United States visa to go to San Francisco to make Vietnamese language broadcasts of material from the U.S. Office of War Information, the U.S. official or "white" propaganda. The visa was denied.
By August, Ho convinced the Kuomintang commander to support his return to Vietnam, leading 18 guerrillas against the Japanese. Accordingly, Ho returned to Vietnam in September with eighteen men trained and armed by the Chinese. Discovering that the ICP had planned a general uprising in the Việt Bắc, he disapproved, but encouraged the establishment of "armed propaganda" teams. These teams would participate in the Viet Minh's first battle against the French.
Vietnamese famine of 1944–1945
From late 1944 and throughout 1945, a great famine ravaged across Vietnam, killing up to 2 million by some estimates. Its causes were attributed to natural disasters, the ongoing war, and poor administration by the French and the Japanese. The Viet Minh successfully directed public resentment toward the occupation powers and, as a result, transformed itself from a guerilla organization into a mass movement.
End of Western rule
The Japanese revoked French administrative control on 9 March and took French administrators prisoner. They murdered those who refused to initially surrender and/or comply with their demands. This had the secondary effect of cutting off much Western intelligence about the Japanese in Indochina. They retained Bảo Đại as a nominal leader.
Even before there was a government of the newly proclaimed Empire of Vietnam, the French Provisional Government declared an intention, on 24 March, to have a French Union that would include an Indochinese Federation. While France would retain control over foreign relations and major military programs, the Federation would have its own military, and could form relationships outside the Federation, especially with China.
There would, however, continue to be a top French official, called High Commissioner rather than Governor General, but still in control. The five states, Annam, Cambodia, Cochin-China, Laos, and Tonkin would continue; there would be no Vietnam. In August, Admiral Georges d'Argenlieu would be named as High Commissioner, with General Leclerc as his military deputy.
Ho's forces rescued an American pilot in March. Washington ordered Major Archimedes Patti to do whatever was necessary to reestablish the intelligence flow, and the OSS mission was authorized to contact Ho. He asked to meet Gen. Claire Chennault, the American air commander, and that was agreed, under the condition he did not ask for supplies or active support.
The visit was polite but without substance. Ho, however, asked for the minor favor of an autographed picture of Chennault. Later, Ho used that innocent item to indicate, to other Northern groups, that he had American support.
Following the Japanese assumption of power in March 1945, they created a government under Bảo Đại. He invited Ngô Đình Diệm to become Prime Minister but, after receiving no response, turned to Trần Trọng Kim and formed a cabinet of French-trained but nationalist ministers.
His authority extended only to Tonkin and Annam; the Japanese simply replaced the former French officials in Cochinchina; Cao Đài and Hòa Hảo members also gained power there.