The Georgians in Ossetia didn’t participate in that vote so it can hardly be considered "democratic and it was never recognized by anyone as being legitimate.
The United Nations, European Union, Organization for Security and Cooperation in Europe (OSCE), Council of the European Union, North Atlantic Treaty Organization (NATO) and most other countries in the world recognize South Ossetia as part of Georgia. However, the de facto republic governed by the secessionist government held a second independence referendum on 12 November 2006, after its first referendum in 1992 was not recognized by the international community as valid. According to the Tskhinvali election authorities, the referendum turned out a majority for independence from Georgia where 99% of South Ossetian voters supported independence and the turnout for the vote was 95%. The referendum was monitored by a team of 34 international observers from Germany, Austria, Poland, Sweden and other countries at 78 polling stations. However, it was not recognized internationally by the UN, European Union, OSCE, NATO and the Russian Federation, given the lack of ethnic Georgian participation and the legality of such referendum without recognition from the central government in Tbilisi. The European Union, OSCE and NATO condemned the referendum.
The de facto independent republics of Abkhazia, Transnistria, and South Ossetia recognized each other’s independence on 17 November 2006. The first member of the United Nations to recognize South Ossetia was the Russian Federation on 26 August 2008, followed by Nicaragua on 3 September. However, the European Union, OSCE, NATO, and most other countries recognize South Ossetia as an integral part of the territory of the state of Georgia.
Given that it’s “an integral part of Georgia” how does one attack one’s own country?