How did Peter I of Russia come to power?

Born in 1672, Peter's power struggles with the Russian aristocracy began at an early age. His father, Czar Alexis I, died in 1676, when Peter was only 4 years old. At that time, succession to the throne was clear, and Peter's elder half-brother was crowned Czar Feodor III. On his deathbed six years later, in 1682, Feodor named 10-year-old Peter as his successor, passing over Feodor's infirm and sickly brother John.

Peter soon became the center of a power struggle between two Russian families.

On one side of the struggle were the Naryshkins, the family of Peter's mother Nataliya Naryshkina. But Nataliya was Alexis's second wife; Maria, his first wife (who died shortly after giving birth to their 13th child) was from the Miloslavsky family, and the Miloslavskys didn't want to lose their position in the royal family. With the help of the Streltsy, the Russian military corps, the Miloslavskys managed to set both Peter and his mentally challenged half-brother Ivan (who became Ivan V) as co-czars, with Ivan the senior of the two. And because both were underage, Sophia, Ivan's older sister (and Peter's half-sister), was set in place as regent.

Sophia ruled as an autocrat for seven years, leaving most general administration and foreign relations in the hands of Prince Galitzin, who may or may not have been her lover.

When Peter was 17, Sophia, sensing that her claim to power would soon vanish, attempted to have Peter abducted (and possibly assassinated) in the middle of the night. However, word reached Peter ahead of time, and he was able to flee to the Trinity Lavra of St. Sergius, an impenetrable monastery.

News of Sophia's treachery spread quickly, and Peter had little trouble gathering followers, including the Streltsy, to his side. Sophia was overthrown and forced into a convent, and Prince Galitzin and his son were banished for life to Siberia.

Ivan V and Peter I officially continued as co-rulers of Russia until Ivan died in 1696, though Ivan really never played a role in government. It wasn't until 1721, when the Russian Senate named him Emperor of Russia, that Peter gave himself the moniker Peter the Great.