In 1677, while still a young man, Gavrila Golovkin was attached to the court of the tsarevich Peter, with whose mother Nataliya he was connected, and vigilantly guarded him during the disquieting period of the regency of Sophia. He accompanied the young tsar abroad on his first foreign tour, and worked by his side in the dockyards of Zaandam. In 1706, he succeeded Golovin in the direction of foreign policy, and was created the first Russian grand-chancellor on the field of Poltava (1709). Golovkin held this office for twenty-five years. In the reign of Catherine I, he became a member of the Supreme Privy Council, which had the chief conduct of affairs during this and the succeeding reigns. The empress also entrusted him with her last will whereby she appointed the young Peter II her successor and Golovkin one of his guardians. On the death of Peter II in 1730, he declared openly in favour of Anna, duchess of Courland, in opposition to the aristocratic Dolgorukovs and Galitzines, and his determined attitude on behalf of autocracy was the chief cause of the failure of the proposed constitution, which would have converted Russia into a limited monarchy. Under Anna, he was a member of the first cabinet formed in Russia, but had less influence in affairs than Osterman and Munnich.