In the 16th century, Gagra was a part of Georgia. It was invaded by the Ottoman Empire. Because of poverty and disease, most of its people had left. After Russia's victory over the Ottomans in 1878, Russia rebuilt the town.