Following the end of World War II, the United States and the Soviet union split up the administration of Korea, with the United States taking charge of the southern half. Beginning in January 1946, the U.S. military government in the south began to form a Korean defense force, and 18 lieutenants from the U.S. Army's 40th Infantry Division were tasked with organizing eight Korea Constabulary Regiments (one for each province,), which were to act as a police force. The Constabulary grew rapidly, from 2,000 men in April 1946 to 50,000 in March 1948. When the ROK declared independence on 15 August 1948, the Constabulary was absorbed into the Republic of Korea Army, and the United States created a Provisional Military Advisory Group (PMAG) to continue the work of training and advising the fledgling South Korean military, led by Brigadier General William Lynn Roberts. The 100 American advisors in Korea, working under the auspices of the Department of Internal Security (DIS), were reassigned to PMAG at this time, and the unit's roster was expanded. KMAG Headquarters, daegu, South Korea circa 1950
On 1 July 1949, PMAG was redesignated the United States Military Advisory Group to the Republic of Korea (KMAG).
When North Korean forces invaded South Korea on 25 June 1950, KMAG became the United States Military Advisory Group, Korea, 8668th Army Unit, under the command of the United States Eighth Army. Brigadier General Francis W. Farrell took command of the unit on 25 July. On 28 December 1950, it was renamed as the 8202nd Army Unit.