Mongolia encountered Russian expansion on her northern border in the 17th century. The Buryats had fought against Russian invasion since the 1620s. The well-armed Russian Cossacks cruelly subdued the resistance of the Buryats and conquered the Baikal region in 1640-1650s. The uprisings of the Buryats were brutally crushed in 1658 and 1696. The Russians attempted to build ostrogs in Khövsgöl area, but they were quickly destroyed by the local population. The Buryat region was formally annexed to Russia by treaties in 1689 and 1727, when the territories on both the sides of Lake Baikal were separated from Mongolia. In 1689 the Treaty of Nerchinsk established the northern border of Manchuria north of the present line. The Russians retained Trans-Baikalia between Lake Baikal and the Argun River north of Mongolia. The Treaty of Kyakhta (1727), along with the Treaty of Nerchinsk, regulated the relations between Imperial Russia and the Qing Empire until the mid nineteenth century. It established the northern border of Mongolia. Oka Buryats revolted in 1767 and Russia completely conquered the Buryat region in the late 18th century.