Joaquin Hernandez Galicia holds up a lawsuit on corruption charges he filed in 2005 against the current union boss of Pemex outside a courthouse in Mexico City. (Roberto Velazquez/Associated Press)

Joaquín Hernández Galicia, the former Mexican oil union boss who rose to control a political empire built on patronage and intimidation but was eventually dethroned by a Mexican president wary of his vast power, died Monday in Tampico, Mexico. He was 91.

Mr. Hernández, who went by the nickname “La Quina,” a play on his first name, had been hospitalized with an abdominal ailment, according to the news agency Notimex.

Both the rise of Mr. Hernández, starting in the 1950s, and his subsequent arrest by then-President Carlos Salinas de Gortari in 1989 demonstrated the legacy of the old feudal system that infected Mexican public life long after the country’s independence from Spain.

His heyday was emblematic of the unique 20th century labor system in Mexico, in which unions, instead of challenging government, were deeply integrated into a one-party political structure within which all disputes and power struggles were meant to be resolved.

Mexico has become a more democratic country in the 21st century. Even so, many of the old-school unions remain intact, including Mr. Hernández’s union, which represents workers in the crucial but troubled state-run oil company, Petroleos Mexicanos, or Pemex. Vestiges of the older, less-transparent time present an ongoing challenge to those who purport to represent the forces of modernization and reform.

“Pemex was a latrine of corruption before La Quina came in, but he turned it into a sewer of corruption,” George W. Grayson, an expert on Mexico at the College of William and Mary, said in an interview. “And it still is.”

Mr. Hernández, son of an oil worker, was a man of slight build who eschewed flash but possessed uncanny political skill. Trained as a welder, he rose to the top of the union in 1958 and thereafter maintained control by doling out favors to local politicians and workers, personally receiving underlings who would ask for loans or help with marital problems.

He also had a reputation for violence. He was publicly accused of slaying slaying of a rival, Heriberto Kehoe Vincent, in 1997, although the accusation was never proved.

Two of his bodyguards allegedly admitted to killing another rival in the 1980s.

But Mr. Hernández’s gravest sin, at least in the eyes of the Institutional Revolutionary Party, or PRI, was to grant his union’s nearly 200,000 members free rein to vote for the presidential candidate of their choice in the 1988 elections.

The PRI, which had dominated Mexican politics for decades, nearly lost that election, with Salinas, its candidate, receiving 50.7 percent of the vote in a count that was suspected to be fraudulent.

In previous elections, the PRI could have counted on the union’s support, but Mr. Hernández was concerned about Salinas’s plans to bring more efficiency to Pemex — which could have meant weakening the union.

On Jan. 10, 1989, the Salinas government, facing the threat of further intransigence from the union leader, had him arrested on weapons charges. Mr. Hernández also was charged in the slaying of a federal agent who died in a shootout with Mr. Hernández’s bodyguards when government officials tried to make the arrest.

Mr. Hernández maintained that the charges were bogus.

He was sentenced to more than 30 years in prison. He was released under an amnesty in 1997.

After his arrest, Mr. Hernández ceased to be a player on the national stage. But his legacy lived on. Soon after the current president of Mexico, Enrique Peña Nieto, took office in December, his government arrested the old-school political boss of the teachers’ union, Elba Esther Gordillo, who potentially stood in the way of a promised educational reform.

Many observers assumed that Peña Nieto was following Salinas’s playbook in the Hernández affair.

Peña Nieto has also proposed reforming Pemex, where Mr. Hernández’s union continues to hold sway. Its workers enjoy some of the best perks in Mexico, including rent and gas subsidies, scholarships for their children and access to a health system of 15 clinics and 22 hospitals. But a 2011 study by the Texas-based Baker Institute found that the workers were 25 percent as efficient as the workers at British oil giant BP and about half as efficient as the workers at Petrobras, Brazil’s partially state-owned oil company.

— Los Angeles Times