In 1977, during internal purges of the Khmer Rouge regime, Hun Sen and his battalion cadres fled to Vietnam. During the Cambodian–Vietnamese War as Vietnam prepared to invade Cambodia, Hun Sen became one of the leaders of the Vietnamese-sponsored rebel army. Following the defeat of the Khmer Rouge regime, Hun Sen was appointed as Deputy Prime Minister and Foreign Minister of the Vietnamese-installed &lt;a href="People%27s%20Republic%20of%20Kampuchea"&gt;People's Republic of Kampuchea/State of Cambodia&lt;/a&gt; (PRK/SOC) in 1979 at age 26. The Vietnamese-appointed government appointed Sen some authority over the K5 Plan, a Khmer Rouge containment strategy that saw the mass mobilization of civilian labor in constructing barricades and land mines, although the extent of his involvement is unclear.