After attending Jefferson College, Canonsburg, Pennsylvania, and reading law under John Thomson Mason, William was admitted to the bar at Hagerstown in 1845.
In 1846 William Hamilton was elected to the Maryland House of Delegates as a Democrat. Here he upheld the payment of interest on the state debt and stanchly supported the general financial policy of the Whig governor, Thomas George Pratt. Owing largely to this lack of machine regularity, he failed of reelection in 1847, but he regained his seat in 1848, although western Maryland was temporarily swept into the Whig line, and in 1849 he began a service as representative of Maryland in Congress which continued until March 3, 1855. As a member of the House he supported orthodox Democratic measures, for he viewed the South as the victim of tyrannical Northern sectionalism. He conducted his campaigns for reelection by means of joint debates in which opposition to protective tariff was his principal argument and in 1852 won the election despite the fact that he was opposed by the veteran politician and debater, Francis Thomas. It was not until the Know-Nothing wave rose menacingly in 1854 that he was defeated.
Upon returning to private life in Hagerstown, Hamilton devoted himself to his law practice, and to municipal interests, personal affairs, and farming. He was especially active in encouraging all improved methods in agriculture. At the outbreak of the Civil War, like most influential Democrats in the border states, he found himself in a difficult position. He upheld the right of the South to secede although he deplored secession. His Southern sympathies were somewhat less pronounced than those of his law partner, Richard H. Alvey, but the two men were leaders in the so-called “Peace” party which was stigmatized by one of the local Unionist sympathizers as “Jeff Davis’ masked battery. ”
By 1867 the Democratic party had rallied in western Maryland, and in 1868 Hamilton was elected to the Senate, serving from 1869 until 1875. A split in the Maryland Democratic machine developed by 1871 and soon grew acute. Hamilton, as the recognized leader of one faction, deplored the dominance of the Chesapeake Canal interests in Maryland politics and on the expiration of his term in the Senate devoted his energies to advocating honesty and economy in the state administration, and reform in political methods. He particularly favored civil-service regulation of state appointments.
In 1875 Hamilton failed to secure the nomination for governor although the convention was closely divided. In 1879, however, he carried the convention and was elected by an easy majority. His views regarding strict economy and political reform foredoomed him to an administration of trouble and friction. The state Senate was largely in the hands of the canal supporters and the treasury department was definitely controlled by his enemies. His message of 1882 was a masterly presentation of the measures necessary for a clean, efficient administration, but his appointments were blocked by the legislature and his measures were frequently rejected. From 1884 until his death he occupied himself with private matters and with the welfare of Hagerstown.
Hamilton was elected as a Democrat to the Thirty-first, Thirty-second, and Thirty-third Congresses, serving from 1849 to 1855. While Hamilton was in Congress, even though his district was largely manufacturers and miners, he supported tariffs but only as a source of revenue for the government. Later in Senate his activity was restricted during the radical Republican ascendancy. He favored rapid resumption of specie payments and upheld the bills for the admission of the Southern states and the resumption of home rule within them. Naturally, he voted against the Fifteenth Amendment. He strongly opposed the “salary grab, ” and refused to profit by it. In his last term he was chairman of the committee for the District of Columbia and was instrumental in securing improvements in the water system of Washington.
Hamilton married, in 1859, Clara Holmes Jenness.