On the death of Richard Cobden he unsuccessfully contested Rochdale as a Conservative, but in 1866 was returned for Helston in unique circumstances. He and his opponent polled exactly the same number of votes, whereupon the mayor, as returning officer, gave his casting vote for the Liberal candidate. As this vote was given after four o'clock, however, an appeal was lodged, and the House of Commons allowed both members to take their seats.
Brett rapidly made his mark in the House, and in 1868 he was appointed Solicitor General. On behalf of the crown he prosecuted the Fenians charged with having caused the Clerkenwell explosion. In parliament he took a leading part in the promotion of bills connected with the administration of law and justice. He was (August 1868) appointed a justice in the Court of Common Pleas. Some of his sentences in this capacity excited much criticism, notably so in the case of the gas stokers' strike, when he sentenced the defendants to imprisonment for twelve months, with hard labor, which was afterwards reduced by the Home Secretary to four months.
On the reconstitution of the Court of Appeal in 1876, Brett was elevated to the rank of a Lord Justice. After holding this position for seven years, he succeeded Sir George Jessel as Master of the Rolls in 1883. In 1885 he was raised to the House of Lords as Baron Esher. He opposed the bill proposing that an accused person or his wife might give evidence in their own case, and supported the bill which empowered Lords of Appeal to sit and vote after their retirement. The Solicitors Act 1888, which increased the powers of the Incorporated Law Society, owed much to his influence. In 1880 he delivered a remarkable speech in the house of Lords, deprecating the delay and expense of trials, which he regarded as having been increased by the Judicature Acts.
In 1850 he married Eugénie Mayer (1814–1904). Eugénie was possibly the illegitimate daughter of Napoleon Bonaparte and Fanny Meyer, though other sources suggest that her father was one Louis Mayer. They had two sons, Reginald, 2nd Viscount Esher, and Eugène, and a daughter Violet. He died in London.