Practice fight of the Dutch Fleet in the honour of Tzar Peter the Great, 1697
Two accounts of the flag's origin connect it to the tricolor used by the Dutch Republic (the flag of the Netherlands).
The earliest mention of the flag occurs during the reign of Alexis I, in 1668, and is related to the construction of the first Russian naval ship, the frigate Oryol. According to one source, the ship's Dutch lead engineer Butler faced the need for the flag, and issued a request to the Boyar Duma, to "...ask His Royal Majesty as to which (as is the custom among other nations) flag shall be raised on the ship." The official response merely indicated that, as such issue is as yet unprecedented, even though the land forces do use (apparently different) flags, the tsar ordered that his (Butler's) opinion be sought about the matter, asking specifically as to the custom existing in his country.
A different account traces the origins of the Russian flag to tsar Peter the Great's visits to Arkhangelsk in 1693 and 1694. Peter was keenly interested in shipbuilding in the European style, different from the barges ordinarily used in Russia at the time. In 1693, Peter had ordered a Dutch-built frigate from Amsterdam. In 1694 when it arrived, the Dutch red-white-and-blue banner flew from its stern. Peter decided to model Russia's naval flag after this banner by changing the sequence of colors.
The Dutch flag book of 1695 by Carel Allard, printed only a year after Peter's trip to Western Europe, describes the tricolor with a double-headed eagle bearing a shield on its breast, and wearing a golden crown over both of its heads.