The Marathas came so close to conquering Goa in 1683 that a desperate Portuguese Viceroy handed his staff to the corpse of St. Francis Xavier, praying for a miracle.
In the late 17th and early 18th centuries, the Maratha Empire was the dominant military power in the Indian subcontinent. They had severely defeated the Mughals and outmaneuvered European colonizers. Yet Goa, the small Portuguese enclave on the Konkan coast, managed to survive—not through Portuguese military superiority, but due to spectacular strokes of geographic and geopolitical luck.
The first reason was geography. Goa's core—the city of Old Goa—was an island (Ilhas) heavily fortified and surrounded by the Mandovi and Zuari rivers. While Maratha forces were devastating on land, they lacked the naval supremacy required to mount a successful amphibious assault against Portuguese galleons.
Despite this disadvantage, Maratha King Sambhaji almost achieved the impossible during that 1683 siege. His forces overran the mainland districts of Bardez and Salcete, driving the Portuguese back to the island of Goa and prompting the Viceroy's famous prayer.
The "miracle" arrived days later, but it wore Mughal armor. Emperor Aurangzeb, attempting to crush the Maratha Empire, sent a massive army under Prince Muazzam into the Konkan. Faced with an existential threat to his own kingdom, Sambhaji was forced to abruptly abandon the siege of Goa and turn his army around to fight the Mughals.
Half a century later, the Marathas tried again. In 1739, Peshwa Baji Rao I launched a massive campaign against Portuguese holdings in India. His brother, Chimaji Appa, successfully besieged and captured the heavily fortified Northern Province (including Bassein/Vasai), breaking the back of Portuguese power. The Marathas simultaneously invaded Goa and once again pushed the Portuguese to the brink of surrender.
But history repeated itself. Just as Goa was about to fall, Nadir Shah of Persia invaded northern India and sacked Delhi. The ensuing chaos forced the Marathas to immediately shift their military focus to the north. They settled for a highly favorable peace treaty with the Portuguese, keeping the vast territories they had conquered in the north but leaving the tiny enclave of Goa intact.
Once stripped of their northern territories, the Portuguese were no longer a strategic threat to the Marathas. Goa remained a small, isolated trading post, surviving into the 20th century primarily because it stopped being worth the effort to conquer.