In 1934, Margiotti ran for the Republican nomination for state governor and lost to Attorney General
William A. Schnader. He then switched parties and successfully supported
George Earle, who then appointed him as Schnader's successor as attorney general. In 1935, Margiotti was appointed state attorney general by Earle. Margiotti prosecuted a number of graft cases involving Earle's administration. Margiotti himself was accused of arranging excessive tax collection fees for his own law firm and sued
The Philadelphia Inquirer for libel over their coverage. In 1938, Margiotti ran for the Democratic nomination for state governor. In 1950, Margiotti was appointed again as state attorney general by Republican Governor
Jim Duff, a personal friend. The incoming 1951 governor, Republican
John Fine, in submitting his Cabinet nominees for approval to the
General Assembly, left the attorney general position blank, as he intending to retain Margiotti without giving the General Assembly a chance to reject him. The Democrats responded by blocking all Cabinet appointments in protest against Margiotti, and after a six-week standoff, Margiotti resigned. ==Prominent cases==