Three Habsburg kings ruled Spain in the 17th century: Felipe III, Felipe IV, and Carlos II. Powerful ministers controlled governmental administration on behalf of the kings. Spain was involved in many wars over territory and religion during this time, including the Thirty Years War, and lost territories in Europe by century's end. The population decreased due to deaths in warfare, famines, plagues, and emigration to the Americas in search of better lives. Muslims were expelled from some areas of Spain, separating children from their parents, though some had been successful merchants previously. The Habsburg dynasty ended in 1700 upon the childless death of King Carlos II.