He was elected for two terms as Prime Minister of Spain , in the 2004 and 2008 general elections .
This was in the 2004 and 2008 general elections .