[2] In June 1684, allegations were made against him that he had libelled the Duke of York (later James II & VII) for authorizing, as Speaker, the publication of Thomas Dangerfield's Information in 1680.
Dangerfield, one of the most notorious of the Popish Plot informers, was by now utterly discredited (he was killed in a scuffle with a barrister the following year).
To provide the protection of a seat in parliament, Williams stood and was elected for Montgomeryshire in 1685; however, his return was cancelled on petition, on the grounds that the contributory boroughs had no opportunity of voting.
Previously a critic of James II, Williams entered the king's service in 1687, being appointed Solicitor General.
He held an important role in the prosecution of the Seven Bishops, but the violent antipathy between himself and the Lord Chief Justice, Sir Robert Wright, who accused him, with no relevance whatever to the issue before the Court, of taking bribes, probably contributed to the verdict of not guilty.
Williams was made a King's Counsel and appointed Custos Rotulorum of Merionethshire and Denbighshire as consolation.