Gondor was founded in the year 3320 of the Second Age of Middle-Earth by Elendil, settled by survivors of the disaster that destroyed Numenor. At first ruled by royals from Elendil's line, it eventually came to ruled by a line of Stewards after the disappearance of Earnur, who answered a challenge from the Witch-King of Angmar.
For centuries, Gondor was the primary front in the battle against Sauron and his forces. During the War of the Ring in year 3019 of the Third Age, Gondor nearly fell before the Dark Lord's invigorated forces. The realm was saved in the Battle of the Pelennor Fields, where Sauron's forces were turned back in part due to Aragorn, the rightful king of Gondor. After the War ended, Aragorn took the throne, leading Gondor into a new age.