Herb Mills, who had a doctorate and taught college classes and read poetry aloud at coffeehouses, didn’t seem like the longshoreman type. Even though he could cuss, and often did.

A longshoreman is what he was, for three decades, working his way up the ranks from cargo unloader to leadership roles in the longshoremen’s union during the 1971-72 waterfront strike, the longest in U.S. longshore history.

Mills, who lived in Berkeley, died Aug. 7 of respiratory failure in a San Leandro hospital. He was 87.

Asked why someone with a doctorate would unload ships for a living, Mills would often reply, “I’d rather sell my back than my head.”

With a lifelong passion for social justice, he led union efforts to block arms shipments to the military governments of Chile and El Salvador. His threat of a union boycott of South Korean shipping helped block the scheduled execution of an opposition leader in that country. He also led efforts to tie the killings of two Seattle longshoremen to the regime of Philippine leader Ferdinand Marcos.

But above all, Mills knew his way around the hold of a cargo ship, and how to work there safely.

“We have the saying, ‘Face me or face the ladder,’” Mills often said. “You do the right thing in the hold. Or you face the ladder — the hatch to get out. So every day in the life of a longshoreman was a moral experience.”

People who knew Mills called him crusty. People who knew him better said there was a lot more to Herb Mills.

“He could be very tough and gruff,” said his former wife, Rebecca. “He was bright, he knew strategy, he was a respected opponent. He cared deeply for working-class people and he understood that, if you unionize people, they’d be better off.”

A native of Dearborn, Mich., Mills was an assembly line worker in a Ford auto plant, a Phi Beta Kappa graduate of the University of Michigan and the holder of a doctorate in political science from UC Irvine. He unloaded his first ship in 1963. With the International Longshore and Warehouse Union, he was a shop steward, organizer, business agent and secretary-treasurer for Local 10 on the San Francisco waterfront.

Mills said his least favorite things to unload were burlap sacks full of coffee beans and dried coconut. They leaked and were filthy, he said. But if they were in the hold of a ship, Mills got them out.

His best friend, community organizer Mike Miller, said Mills loved the camaraderie and closeness among longshore crews, and their use of expressive language while on the job.

“Herb said ‘f—’ in speech more than anyone I ever met,” Miller said.

During Mills’ days, the unloading of ships became largely mechanized with the coming of cargo containers and giant cranes. When he started, four-member crews worked in the hold, where an incautious moment or an equipment failure could lead to injury. A 1988 winch malfunction left Mills with serious back and leg injuries. He retired in 1991.

In his spare time, he was a passionate hiker, Sierra camper and fisherman. He was a lifelong reader and expert on ancient history, biblical studies and the American novel. At the time of his death, he was writing a semiautobiographical novel, titled “Presente.”

He is survived by his children, Sarah of Berkeley, Jon of Monterey and Lydia of Santiago, Chile; and five grandchildren. He is also survived by his former wife, Rebecca, and longtime partner Deanne Burke, both of Berkeley.

A memorial celebration will be held at 10 a.m. Oct. 27 at St. John’s Presbyterian Church, 2727 College Ave., Berkeley.

Steve Rubenstein is a San Francisco Chronicle staff writer. Email: srubenstein@sfchronicle.com Twitter: @SteveRubeSF