what country gained independence from spain in 1816 and had a long period of violence and war?