finally he was sent to peru where san martín already had occupied the capital lima