Change the voice: The People elected him the president of their country.
Change the voice: The People elected him the president of their country.
Explanation
Active voice: The People elected him the president of their country.
This is simple past tense, so the passive voice should also be in simple past → was elected.
The correct structure:
Subject + was elected + complement + by + agent
→ He was elected the president of their country by the people.