He went to work as a lawyer in
Townsend, Vermont, where he remained for three years before moving to
Burlington, Vermont. In 1850, he first moved to
Sheboygan, Wisconsin, and was elected to the
Wisconsin State Assembly in 1851. During the
1852 legislative session, Shafter served as
speaker of the Assembly. In the fall of 1852, he was the Whig Party nominee for
United States House of Representatives in
Wisconsin's 3rd congressional district, but he lost that election to Democrat
John B. Macy. In 1855, he then moved to
San Francisco, California, where he practiced law with his brother,
Oscar L. Shafter. In 1857, a complex real estate litigation resulted in the Shafter firm winning a victory for their client of 75,000 acres of farm land at
Point Reyes in Marin County. The client sold the property to the Shafters. They leased it to dairy farmers who provided milk and butter to an ever-growing San Francisco and prospered. The Shafter families owned most of Point Reyes from 1857 to 1919, when the land was sold in parcels. In 1862, Shafter served in the
California State Senate and was its
President pro tempore. Shafter also served in the
California Constitution Convention of 1878 and was on the
University of California Board of Regents ex officio as President of the California State Agricultural Association. In November 1885, he was appointed one of the original trustees of
Leland Stanford Junior University. In March 1888, Shafter survived a gunshot at close range. His son, Dr. James Shafter, had sued for a divorce and the wife's brother, angry at the proceedings, confronted the elder Shafter in the San Francisco City Hall. The brother fired four times at point blank range but missed his mark. Near the time of his death, his large
dairy ranch in
Marin County, California, was described as one of the largest ranches in the world—over 23,000 acres. ==Personal life==