The story begins on Trantor, the capital planet of the 12,000-year-old Galactic Empire. Though it has endured for so long, and appears outwardly to be strong and stable, the Empire has been imperceptibly declining for centuries. The only one who realizes this is Hari Seldon, a mathematician who has developed the science of psychohistory, by which it is possible to predict future events by extrapolating from historic trends. He has set up a project which is increasingly harassed by Imperial officials from the Commission of Public Safety — the actual rulers of the Empire. They finally arrest Seldon and Gaal Dornick, a young mathematician who has just arrived to join the project.
At Seldon's trial, more details begin to emerge. Seldon predicts that the Empire will collapse within 300 years, leading to a 30,000-year period of anarchy before a Second Empire is established. The purpose of his project is to influence events so that the interregnum period will be only 1,000 years, instead of 30,000. This will be done, he says, by the production and dissemination by his team of an Encyclopedia Galactica, which will contain all known human knowledge. The Commission is satisfied that Seldon's project is not a threat to the Empire, but wants to quiet him. He and his team are exiled to Terminus, a small planet on the periphery of the galaxy, to work on the Encyclopedia, which is chartered as an Imperial foundation