As head of state, the president of Sri Lanka, is nominally the commander-in-chief of the armed forces. The National Security Council, chaired by the president is the authority charged with formulating and executing defence policy for the nation. The highest level of military headquarters is the Ministry of Defence, since 1978 except for a few rare occasions the president retained the portfolio defence, thus being the minister of defence. The ministry and the armed forces have been controlled by the during these periods by either a minister of state, deputy minister for defence, and of recently the permanent secretary to the Ministry of Defence. Prior to 1978 the prime minister held the portfolio of minister of defence and external affairs, and was supported by a parliamentary secretary for defence and external affairs.