Hamilton's Federalist 68: The EC -- Unfit Persons and the Prevention of Foreign Influence in Gov't [View all]
.
Therefore, the direct election of the president is left up to those who have been selected by the voters to become the electors. This indirect election is justified by Hamilton because while a republic is still served, the system allows for only a certain type of person to be elected president, preventing individuals who are unfit for a variety of reasons to be in the position of chief executive of the country.
This is reflected in his later fears about the types of people who could potentially become president. He worries that corrupted individuals could, particularly those who are either more directly associated with a foreign state, or individuals who do not have the capacity to run the country. The former is covered by Article II, Section 1, v of the United States Constitution, while the latter is covered by Hamilton in Federalist 68, where he notes that the person who will become president will have to be a person who possesses the faculties necessary to be a president, stating that,
Talents for low intrigue, and the little arts of popularity, may alone suffice to elevate a man to the first honors in a single State; but it will require other talents, and a different kind of merit, to establish him in the esteem and confidence of the whole Union, or of so considerable a portion of it as would be necessary to make him a successful candidate for the distinguished office of President of the United States
https://en.wikipedia.org/wiki/Federalist_No._68
.