Although explored by the Spanish early in the 16th century , initial attempts at colonizing Costa Rica proved unsuccessful due to a combination of factors , including : disease from mosquito-infested swamps , brutal heat , resistance by natives , and pirate raids .