Pushkin started to work on the novel towards the end of July 1827 in Mikhailovskoye and in spring 1828 read some drafts to his friends, including poet Pyotr Vyazemsky.
During Pushkin's lifetime, two fragments were published: in the literary almanac Severnye Tsvety (1829) and in the newspaper Literaturnaya Gazeta (March 1830).
All the extant parts were first published after Pushkin's death by the editors of the journal Sovremennik in 1837, who also gave the novel its current title.
The main character of the novel, Ibrahim, is loosely based on Pushkin's maternal great-grandfather, Abram Petrovich Gannibal, a black African who was brought to Russia during the reign of Peter the Great.
The latter is interrupted by the arrival of the Tsar, who wants to marry Ibrahim to the Gavrila's daughter, Natalia.