Turkmen and Russians, who had had trade relations since the XVIII century, continued them in the XIX century, establishing trade relations and opening new markets. The Russians, who had begun the occupation of the Khanates in Turkestan in 1860, built a fortress in Kyzylsu (Krasnovodsk) on the coast of the Caspian Sea in 1869, and on the basis of this, prepared for the Russian invasion of Turkmenistan and Central Asia.
In 1864-1865 the Russians took possession of the Kokand Khanate and conquered Tashkent and Samarkand. In 1868-1871 they conquered the Bukhara Khanate and established a “Generalgouvernement Turkestan” on the territory of these two Khanates under the leadership of General von Kaufman.
In 1874 they founded the “Transcaspian Military Union” under the leadership of General Lomakin. After the Russians had brought Bukhara and Khiva under their control, they penetrated from the Caspian Sea to the Achal region and continued to conquer new territories. Then the Turkmen, led by Berdi Murad Khan, son of Nurberdi Khan, fortified the castle of Gök-Tepe and dug a deep moat around it. The Russians attacked Gök-Tepe in August 1879 and after many days of artillery fire they conquered the fortress. As a result, several thousand Turkmen were killed. After the bombardment was stopped, the Turkmen began to attack the Russians and threw them back to the Caspian Sea coast. Berdi Murad Khan died in this battle.
In December 1880 the Russians returned to Gök-Tepe, dug an underground tunnel to the fortress, blew up the entrance gate and conquered the fortress.
After the decisive battle for the Russian invasion of Turkmenistan at Gök-Tepe, on 18 January 1881, the Russians went to Ashgabat and founded the Eastern Caspian region, which included the cities of Mangishlak, Kizisy, Ashgabat, Tejen and Merv.