In December 2004 , Hamid KARZAI became the first democratically elected president of Afghanistan and the National Assembly was inaugurated the following December .