Longueville visited him there, and found him 'pretty well, good company, and temperate in what he said' (Hatton Corresp. iii. 35). On 7 Dec. 1683 Evelyn was received by him with great kindness (Evelyn, Diary, ii. 424).
From the moment of his arrest Oates and his crew had pursued him with unrelenting malignity, and the odium with which the public regarded him increased. Many pamphlets issued in 1679 and 1680 asserted that Oates bad revealed the popish plot to Danby in secret meetings, in obscure parts of London, at an early stage of his alleged discoveries; that Danby had taken no action against the pretended conspirators from a desire to shield them; that his supineness had roused the suspicions of Sir Edmund Berry Godfrey [q. v.], and that Danby had consequently plotted Godfrey's murder (cf. Reflections upon the Earl of Danby in relation to Sir Edmund Berry Godfrey's Murder, 1679). His secretary, Edward Christian, issued 'Reflections' rebutting the absurd charges. But the libellous accusation respecting Godfrey continued in circulation for more than two years, and in 1681 Edward Fitzharris [q. v.] attempted to free himself from a charge of treason by concocting a detailed story directly implicating Danby in the murder. On Fitzharris's evidence the Middlesex grand jury indicted Danby in May 1681 for the crime. A few days later Danby petitioned the king in council to arrange for his immediate trial by his peers on the indictment, but no decision was taken. On 3 June 1681 he moved the court of king's bench to take action against the publishers and booksellers who had printed and sold the false evidence brought against him by Fitzharris. These proceedings also proved abortive.
As Oates's credit drooped, the public came to recognise that the charge was a wilful fabrication, and meanwhile Danby made unremitting endeavours to secure his freedom by appeals both to the king and to parliament. He petitioned the parliament meeting at Oxford in 1681 to dismiss the political charges against him, but for a third time a dissolution deprived him of a hearing. On 27 May 1682 he appeared in person before the court of king's bench, and applied for bail. His request was refused, Mr. Justice Raymond alone dissenting, on the ground that the judges were incompetent to meddle in the matter of an impeachment by parliament, which was a court superior to their own. Another application in May 1683 proved equally unsuccessful; but after Jeffreys had become lord chief justice, the court unanimously declared on 12 Feb. 1683–4 that he ought to be admitted to bail, and accordingly he was bound over in 20,000l. to appear before the House of Lords in the succeeding session. The Dukes of Somerset and Albemarle and the Earls of Oxford and Chesterfield became sureties in 5,000l. each, and Danby at length left the Tower. 'He came the same day,' says Reresby, 'to kiss his majesty's hand in the bedchamber, when I happened to be present; and when the earl complained of his long imprisonment, his majesty told him, he [i.e. Danby] knew it was against his consent, which his lordship thankfully acknowledged; but they had no manner of private discourse together.' On 19 May 1685, in the first parliament of James II's reign, Danby appeared at the bar of the House of Lords, and was discharged from his recognisances. At the same time the order of 19 March 1679, authorising the maintenance of an impeachment in the parliament following that in which it was framed, was annulled, and Danby again took his seat among the peers. He at once proved himself an active and powerful member of the tory party.
But before the first year of James II's reign closed Danby found himself in opposition to the government. As a protestant he distrusted the king, and on the dismissal of his friend George Saville, marquis of Halifax, from the presidency of the council (December 1685), he began to speak openly against James's arbitrary acts. He was still remembered as the chief promoter of the marriage of Mary and William of Orange, and was respected at the Hague. Consequently he was sought out by William's agent, Dykvelt, and was easily induced to consider the claims of James's daughter to take James's place on the throne. In September 1687 he attended private conferences between Dykvelt and the chief opponents of James II. In June Dykvelt carried to Holland a letter from Danby boldly favouring William and Mary's pretensions to the English crown. As a leading representative of the tories, he knew that his adherence was of the utmost importance to the party favouring the change of dynasty. The whigs immediately made advances which he received in a friendly spirit, and a formal reconciliation took place between himself and the Earl of Devonshire, one of the managers of his impeachment. His next step was to join the revolutionary conspiracy which Russell and Henry Sidney inaugurated, and he won over Compton to the cause. As one of the seven chiefs of the conspiracy he signed the invitation to William. In November he left London to seize York for the Dutch prince.
When the Revolution was accomplished