Despite this, Thiệu agreed to join the coup against Ngô Đình Diệm in November 1963 in the midst of the Buddhist crisis, leading the siege on Gia Long Palace. Diệm was captured and executed and Thiệu made a general. Following Diệm's death, there were several short-lived juntas as coups occurred frequently. Thiệu gradually moved up the ranks of the junta by adopting a cautious approach while other officers around him defeated and sidelined one another. In 1965, stability came to South Vietnam when he became the figurehead head of state, while Air Marshal Nguyễn Cao Kỳ became prime minister, although the men were rivals. In 1967, a transition to elected government was scheduled; and, after a power struggle within the military, Thiệu ran for the presidency with Kỳ as his running mate—both men had wanted the top job. To allow the two to work together, their fellow officers had agreed to have a military body controlled by Kỳ shape policy behind the scenes. Leadership tensions became evident, and Thiệu prevailed, sidelining Kỳ supporters from key military and cabinet posts. Thiệu then passed legislation to restrict candidacy eligibility for the 1971 election, banning almost all would-be opponents, while the rest withdrew as it was obvious that the poll would be a sham; Thiệu won more than 90 percent of the vote and the election was uncontested, while Kỳ retired from politics.