structural:expansion, linguistic:voice_change, stylistic:style_transfer
Falling out of favour

While Marlborough fought in the Low Countries, a series of personal and party rivalries instigated a general reversal of fortune. The Whigs, who were the main prop of the war, had been laying siege to Godolphin. As a price for supporting the government in the next parliamentary session, the Whigs demanded a share of public office with the appointment of a leading member of their Junto, the Earl of Sunderland (Marlborough's son-in-law), to the post of Secretary of State. The Queen, who loathed Sunderland and the Junto, and who refused to be dominated by any single party, bitterly opposed the move; but Godolphin, increasingly dependent on Whig support, had little room for manoeuvre. With Sarah's tactless, unsubtle backing, Godolphin relentlessly pressed the Queen to submit to Whig demands. In despair, Anne finally relented and Sunderland received the seals of office; but the special relationship between Godolphin, Sarah, and the Queen had taken a severe blow and she began to turn increasingly to a new favourite – Sarah's cousin, Abigail Masham. Anne also became ever more reliant on the advice of Harley, who was convinced that the duumvirate 's policy of appeasing the Whig Junto was unnecessary, had set himself up as an alternative source of advice to a sympathetic Queen.

Following his victory at Ramillies, Marlborough returned to England and the acclamation of Parliament; his titles and estates were made perpetual upon his heirs, male or female, so "the memory of these deeds should never lack one of his name to bear it". However, the Allied successes were followed in 1707 with a resurgence in French arms on all fronts of the war, and a return to political squabbling and indecision within the Grand Alliance. The Great Northern War also threatened dire consequences. The French had hoped to entice King Charles XII of Sweden to attack the Empire regarding grievances over the Polish Succession. In a pre-campaign visit to the King's headquarters at Altranstädt, Marlborough's diplomacy helped placate Charles and prevent his interference regarding the Spanish Succession. Following the 1706 Treaty of Altranstädt, Tsar Peter the Great of Russia unsuccessfully offered the yet to be conquered Polish crown to Marlborough, among other candidates.

In Altranstädt, Marlborough reportedly approached Carl Piper, the most favoured of the King's advisers. Allegedly, he offered Piper a pension in exchange for advising Charles XII to launch an invasion of Russia, as this would distract Charles from interfering in the War of the Spanish Succession. Carl Piper was accused of having accepted Marlborough's bribe, advising Charles to invade Russia. Carl Piper denied having accepted Marlborough's offer, but he did admit that Marlborough provided his wife, Christina Piper with a pair of valuable earrings which she accepted, and it was the habit of Carl to personally refuse bribes but allow his wife to accept them and then follow her advice.

Nevertheless, major setbacks in Spain at Almansa and along the Rhine in Southern Germany, had caused Marlborough great anxiety. Prince Eugene's retreat from Toulon (Marlborough's major goal for 1707) ended any lingering hopes of a war-winning blow that year.

Marlborough returned from these tribulations to a political storm as the Ministry's critics turned to attack the overall conduct of the war. The Duke and Godolphin had initially agreed to explore a "moderate scheme" with Harley and reconstruct the government, but they were incensed when Harley privately criticised the management of the war in Spain to the Queen, and his associate Henry St John, the Secretary at War, raised the issue in Parliament. Convinced of Harley's caballing, the duumvirs threatened the Queen with resignation unless she dismissed him. Anne fought stubbornly to keep her favourite minister, but when the Duke of Somerset and the Earl of Pembroke refused to act without "the General nor the Treasurer", Harley resigned: Henry Boyle replaced him as Secretary of State, and his fellow Whig, Robert Walpole, replaced St John as Secretary at War. The struggle had given Marlborough a final lease of power but it was a Whig victory, and he had to a large extent lost his hold on the Queen.