TKVIAVI, Georgia—Georgian defenses collapsed within days of Russia’s invasion in 2008. Moscow-backed militias killed and rampaged in the countryside as Russian tanks roared unopposed on the highway to capital Tbilisi.

A pharmacist from this leafy village, Fatima Papiashvili, and her daughter Diana, aged nine at the time, witnessed the murders of their neighbors, and were fortunate to escape to safety with the help of a Wall Street Journal reporter.

Today, the legacy of that catastrophic military defeat still drives Georgian politics. In recent months, as Russia regained momentum in Ukraine, the government in Tbilisi has hewed closer and closer to Moscow, moving away from the Caucasus nation’s longstanding pro-Western aspirations.

Weeks of often violent mass protests and clashes with police have already rocked Tbilisi, and the U.S. has imposed sanctions on leaders of Georgia’s ruling party. In a country that experienced a bloody civil war, three conflicts with Russia and a revolution since independence in 1991, national elections set for October loom as a major flashpoint—and a possible pivot for the entire region.

The divide runs right across the Papiashvili family.

Like many Georgians, especially in the older generation, Fatima says she intends to vote for the ruling Georgian Dream party, led by reclusive billionaire Bidzina Ivanishvili . The main reason: She wants peace with nearby Russia at any cost, especially after watching the horrors unfolding in Ukraine. Now 65 years old, Fatima said she agreed with Ivanishvili’s key message: that a vote for the pro-Western opposition is essentially a vote for renewed conflict.

“The protesters in Tbilisi, they are shouting and screaming because they haven’t seen what war is really like,” Fatima said in Tkviavi, recalling how the village was cut off, without any food, electricity or phone connections, back in 2008. “I like America, I like Europe, but there is no chance that Russia will let us go that way.”

Diana shook her head in disagreement as she cradled her dog, Vivian. Now 25, she has recently graduated from university in Tbilisi and wants to be a graphic designer.

Though she hadn’t personally participated in protests because of health issues, Diana said she supported her classmates who had flooded the capital’s streets as the Georgian Dream pushed through legislation limiting civil society. The unprecedented outpouring of Georgian youth, many of them waving European Union flags, initially forced the government to pull the law—just to ram it through on a second attempt in June, overruling a veto by the country’s largely ceremonial president.

“We have to fight for our freedom. If we don’t fight, we will be slaves,” said Diana, who traveled across Europe in recent years, a freedom enjoyed by the country’s citizens after the EU abolished visa requirements for them in 2017.

Once praised as a pioneer in adopting good governance, Georgia used to be seen as one of the most solidly pro-Western parts of the former Soviet Union, and opinion polls still show overwhelming support for joining the EU and NATO.

Alongside Ukraine, it was promised an eventual membership in the NATO alliance at the Bucharest summit all the way back in 2008, and officially became an EU candidate last December. With 20% of the country occupied by Russian forces, Georgia technically doesn’t maintain diplomatic relations with Russia—though the border is open and direct flights disgorge thousands of Russian tourists every day.

Georgia’s unfolding break with the West was catalyzed by this summer’s strict restrictions on foreign funding for nongovernment organizations, media and civil society. Dubbed “the Russian law” by the opposition, the new legislation mirrors similar “foreign agent” curbs enacted by Russian President Vladimir Putin in 2012 as he eviscerated political freedoms there.

In another borrowing from Putin’s political playbook, the Georgian government now is moving ahead with a law that would ban LGBT “propaganda” such as Pride events, and uphold “traditional values.” In recent months, many antigovernment activists have been assaulted by thugs believed to be connected with the authorities.

“We are now in the same situation where Russia was in 2012. If the Georgian Dream begins to enforce this Russian law, they will basically get rid of international organizations, of donor organizations, kill the civil society, and then the independent media and the opposition parties, as it has already happened in Russia,” said Zurab Japaridze, founder of the opposition Girchi party who said he had to use his sidearm to fire in the air as he was being attacked near his home earlier this year.

Georgian Dream leaders deny the government is connected to such assaults on opposition leaders, and say the new legislation, which requires media and NGOs receiving more than 20% of their funding from abroad to register as agents of a foreign power and undergo stringent audits, isn’t all that different from similar laws in the West.

Still, they are open about their intentions to further crack down on dissent. Prime Minister Irakli Kobakhidze said this month that Georgian Dream, if it wins an overwhelming majority in the October election, will use its new constitutional powers to ban all the main opposition parties and to unseat opposition lawmakers, whom he described as “criminals.”

The geopolitical stakes in Georgia are hard to overstate. The mostly Christian country of 3.7 million provides the only alternative route besides Russia for Central Asian and Azerbaijani trade with the West, be it in oil, gas or other goods. One of only three former Soviet republics—alongside Ukraine and Moldova—with EU candidate status, it has historically been the most consistent outpost for pro-Western feeling in the region, sitting between authoritarian Russia, Turkey and Iran.

“We have had political differences in Georgia, sometimes they were very harsh, but no matter these differences, all the governments that were here were clearly pro-Western,” said former Georgian President Giorgi Margvelashvili , a onetime ally of Ivanishvili. “Now this is the first time that the government is changing the geopolitical orientation of the nation,” he added. “For Russia ideologically this is a huge, huge win.”

Recognizing Georgia’s drift away from the West, last month’s annual NATO summit declaration didn’t mention the country’s prospects for membership, the first such omission since 2008. Contacts on joining the EU have also been frozen. The U.S., which earlier this year imposed visa sanctions on leading members of Georgian Dream, in July suspended $95 million in aid that benefits the Georgian government and is mulling curbs on longstanding defense cooperation.

Ivanishvili’s landmark speech at a Tbilisi pro-government demonstration in late April, a rare public appearance for the country’s most powerful man, marked a clear shift in rhetoric. Ivanishvili—who had lived in Moscow for decades and once held a Russian passport—accused the “global war party” in the West of trying to overthrow his government. The main reason, according to him: Georgia’s refusal to become “cannon fodder” and open “a second front” against Russia.

The Georgian government, which has refused to impose its own economic sanctions on Russia or to assist Ukraine with weapons, must be careful in its relations with the Kremlin as a matter of national survival, said Nikoloz Samkharadze, the head of the parliament’s foreign-relations committee and a leading member of Georgian Dream.

In past wars against Russia, the U.S. and allies did next to nothing to assist Georgia, and Russian occupation troops are currently stationed only 500 meters from the main highway linking Tbilisi to the Black Sea coast, he said.

“I can tell you very frankly and openly, we are afraid of Russia…Imagine a scenario where the Russians just turn on the engine of an armored vehicle—not even a tank—and put it on that highway. What do you do as a state? If you shoot, then it’s a war with Russia. And if you don’t shoot, then you’re not a state,” Samkharadze said. “We have learned our lessons, and we know that if there is another war between Russia and Georgia, we will again be all alone.”

Western—and opposition—accusations that Georgia is siding with Russia in the war in Ukraine are misplaced, added Maka Botchorishvili, a senior member of Georgian Dream and chair of the parliament’s EU integration committee.

“Georgia has never shied away from supporting Ukraine in the international arena,” she said. “But what kind of sanctions can Georgia impose on Russia to influence Russia? Zero. We cannot impact the Russian economy but they can impact the Georgian economy heavily, and they can impact Georgian security heavily.”

Such arguments resonate in places that bore the brunt of the Russian invasion in 2008—an invasion that many Georgians blame on the reckless policies of then-president Mikheil Saakashvili , currently in a Georgian prison on charges of abuse of power that his supporters say are politically motivated. Ivanishvili this month promised to hold a “Nuremberg trial” for Saakashvili after the election.

“How many wars have we survived here!” exclaimed Larisa Miruashvili, as she played with her granddaughter in a park in the city of Gori, which was occupied by Russian troops in 2008. “The current government is trying its best to have peace and stability, and for this I am really thankful.”

Merab Merabishvili’s apartment in Gori burned down when a Russian cluster munition hit nearby in August that year, killing a Dutch journalist. “Everybody was running away from the city at the time. Nobody was left here, and I don’t want this to happen again,” said Merabishvili, a 65-year-old former driver who also said he will vote for Georgian Dream. “We now want to be friends with Russia.” The Stalin museum in Gori, the former Soviet leader’s hometown, was packed with Russian tourists buying fridge magnets with the dictator’s likeness.

In Tkviavi, which was raided by South Ossetian militiamen allied with Russia in 2008, Fatima Papiashvili recounted how one of these men threatened to shoot her, just to have another militiaman overrule him by saying that they only kill Georgian men. When this reporter visited Tkviavi in August 2008, the stench of rotting corpses of several male villagers wafted from courtyards, mixing with the smell of overripe peaches on trees. At the time, Fatima asked for help in getting her and her daughter across the front line, to reunite with her sister in the Georgian capital.

As Fatima drove in a Journal car through several checkpoints, including one where Chechen irregulars joked about on-the-spot executions, she instinctively pushed Diana into the footwell, so that the girl wouldn’t be seen. Curious, the child kept perking up all the way until she arrived in a Tbilisi hotel for an ice-cream treat.

Diana, who said she remembers all the details of that journey despite the passage of time, listened impatiently as her mother recounted the terrifying events of 2008. She disagreed vigorously once Fatima said she would vote for Ivanishvili’s Georgian Dream because the current government has brought peace to the country.

“We must have hope,” Diana said quietly but sternly, in English. “Don’t give up.”

To many Georgians, the crisis in the country reminds of events in Ukraine in the final months of the rule of President Viktor Yanukovych, who triggered mass protests, known as the Maidan revolution, after suddenly aborting an association agreement with the EU and embarking on an alternative trade alliance with Russia in late 2013. Ivanishvili, too, alluded to that parallel—warning in the April speech that, unlike Yanukovych, he won’t allow his party’s government to be overthrown. He declined an interview request.

Georgia’s antigovernment protests have died down for now, as students left Tbilisi for their hometowns, but are widely expected to resume next month, as the campaign for the Oct. 26 elections gets into full swing. That’s the time when the government is likely to highlight the anti-LGBT legislation, which is popular in the conservative countryside and has the blessing of the Georgian Orthodox Church.

For the fragmented Georgian opposition, unseating the government wouldn’t be easy. Georgia’s president, Salome Zourabichvili , who has limited powers under the new constitution and who tried and failed to block the foreign-agent law, is trying to coordinate between various opposition parties. Under Georgia’s electoral law, a party or union of parties must cross the 5% threshold to gain parliament seats.

“We believe that the unification of all pro-Western opposition forces is a public demand at this point, and we have to rise to the challenge,” said Tina Bokuchava, chair of the largest of these parties, the United National Movement, which was founded by Saakashvili. “Ivanishvili is essentially turning these elections into a referendum between Russia and Europe.”

To others in the opposition, however, embracing the UNM is a poisoned chalice because Saakashvili’s second term was marred by widespread human-rights abuses and arbitrary detentions. If forced to choose between Ivanishvili and a return of Saakashvili to power, many Georgians would rather pick the country’s current rulers “because at least they are promising peace,” said Mamuka Khazaradze , chairman of the Lelo opposition party and co-founder of one of the nation’s main banks.

Just as in Ukraine during Maidan, there is also widespread mistrust between organized political parties and the new, informal protest movement that has coalesced around street protests.

Still, a sense that Georgia approaches an existential moment is in the air. Tina Khidasheli, chair of the Civic Idea NGO, said the country faces the strong risk of becoming a dictatorship and a satellite of Russia if Ivanishvili’s Georgian Dream wins re-election in October.

“We will do everything so it will not happen. Literally everything. Whatever it takes to get this country back,” said Khidasheli, a former minister of defense. “Bidzina [Ivanishvili] is not going to end this country’s history as an independent state. No way.”

Write to Yaroslav Trofimov at yaroslav.trofimov@wsj.com