Georgian-Safavid War - also known as Seventh Ottoman-Safavid War began in 1665, when Safavids attempted to retake Kartl-Kakheti from Georgia which resulted in full scale invasion of Iran and loss of Caucasus on Safavid's part.
King Alexander II passed away in 1665 and was succeeded by his son Bagrat. Safavids assumed that Georgia would be weakened after their king's death so they began planning another invasion into Georgia. That same year, a 100,000-man army led by Shah Abbas II himself crossed into Kakhetia and began traveling toward Tbilisi. King Bagrat was notified about the invasion, so began assembling an army to meet the invaders. Ottoman Sultan Mehmed IV, was informed of the invasion. Not helping your "Vassal" would be considered as a huge blow to Ottoman prestige, so Mehmed assembled his Army and rode toward Georgia.
Siege of Tbilisi
Shah Abbas II laid siege to Tbilisi in November of 1665. Tbilisi was well fortified so Shah did no want to waste his manpower on pointless assaults. Meanwhile, Mehmed IV combined his forces with Pasha of Akhaltsikhe and marched Traveled to meet Bagrat. Mehmed combined his forces with Bagrat and Begna preparing for a surprise attack on Safavids. Ottoman-Georgian relief force charged into demoralized Persian army and caused mass-panic. Shah Abbas was killed in action and his country was left without a leader ...
Ottoman and Georgian Armies parted ways, Ottomans marched toward Mainland Persia while Georgians went for Armenia and Shirvan. Bagrat took multiple castles in Northern Armenian including Yerevan before crossing into Karabagh where he was met by Melik Hasan-Jalalyan, who instead of attacking him, pledged loyalty and joined his campaign. Bagrat made his way toward Shirvan and besieged its capital Baku, which fell shortly. Fearful of Total Annihilation, Safavids sued for peace.
Safavids agreed to cede its Caucasian possessions to Ottomans. As a reward for participation, Georgians were allowed to keep Yerevan and Karabagh. Bagrat wanted to gain control of Shirvan but his request was denied by The Sublime port and a Pashalik was created instead. In addition to not ceding Shirvan, Ottomans set up their garrison in strategically significant parts of Georgia, further straining relations with Georgian king. Costly war proved to be fatal to Safavids, as revolts spread throughout Persia and soon enough, the Age of Anarchy began.