On 30th July 1838, General Orbegoso declared the State's independence from South Peru and Bolivia. The Chileans adopted a neutral air declaring that their quarrel was not with Peru but with General Santa Cruz, the president of the Bolivian Confederation. Still, the Chileans landed in early August 1838 and occupied a position between Callao, where William had landed, and Lima, where he now worked and stayed. The situation was unmistakably hostile with their position cutting off Lima from its port.
The Chileans had a force of 5,000 men and were met by General Orbegoso, conflict ensued and the Chilean enemy entered the city of Lima. "At half past eight all was silent except for the groans of the dying. Next morning the bridge and the banks of the river were strewn with dead and wounded." The diary of William Fea records this further.
The stronghold of Callao Castle had not yet surrendered and General Orbegoso, with 1,500 men took refuge there with the intention of uniting with the Bolivians against the Chileans.
The Bolivian leader arrived on 8th December 1838, with a well disciplined army, and the Chileans evacuated Lima. It was left for a day without authority or power and the Bolivians entered the City on 10th December 1838.
The fleeing General Gamarra had been unpopular with the people of Lima. In 1834, after five years of his rule, he had refused to resign following an election and had to be forcibly ejected by the inhabitants, who pelted him out of the city. He had come back in a coup.
General Santa Cruz's occupancy of Lima was brief as General Gamarra returned and, in the Battle of Yungay on 20th January 1839, defeated the much loved Bolivian governor. William Fea recorded the return of General Gamarra, to Lima, in his diary.
General Santa Cruz and the English General Miller, from Callao, left with General Miller's most senior officers a few days prior to General Gamarra's "triumphant" entry in Lima with his army. Everything was done to make this return as impressive as possible. There were illuminations for three successive nights and fireworks.