The country served as a buffer between the British and Russian Empires until it won independence from notional British control in 1919 .