Matthew G. Martinez, 82, who served nine terms in the U.S. House of Representatives as a Democrat from East Los Angeles before conflicts with party leaders led him to become a Republican in his final term, died Oct. 15 at his home in Fredericksburg.

He had congestive heart failure, said his wife, Maxine Grant Martinez.

Rep. Martinez grew up in a rough Los Angeles neighborhood, served in the Marine Corps in the late 1940s and owned an upholstery business in Monterey Park, Calif., before launching a political career.

He was a city council member and mayor of Monterey Park, and he was elected to the California State Assembly before winning a 1982 special election to Congress. He served in the U.S. House until 2001, focusing on job-creation legislation.

As chairman of an education and labor subcommittee on employment opportunities, he helped pass a federal program that offered states incentives to assist welfare recipients in finding employment.

Rep. Martinez, who pointed to his membership in the National Rifle Association, voted against the 1993 Brady Handgun Violence Protection Act, which requires a background check before the purchase of firearms.

A year later, after lobbying from the Clinton administration, Rep. Martinez reversed his stance and voted for the ban of certain assault rifles.

In 2000, Mr. Martinez was defeated in a Democratic primary by Hilda Solis, who is now the labor secretary. Solis was backed by the state’s Democrats, and Rep. Martinez told The Washington Post in July 2000 that he felt alienated by party leaders.

“They turned their back on me,” he told The Post.

Later that July, Rep. Martinez became a Republican, finishing his last months in office voting against the Democrats at every opportunity.

Matthew Gilbert Martinez was born Feb. 14, 1929, in Walsenburg, Colo., and grew up in Los Angeles.

He told the New York Times in 1992 that he left home at 12 because his mother beat him. He became associated with a gang called White Fence.

“I ran away from home, hid out, bummed off friends, stole milk and bread and learned how to survive,” he told the Times.

Rep. Martinez was separated for many years from his first wife, the former Elvira Yorba, before they divorced in the early 2000s.

Besides his second wife, of Fredericksburg, survivors include five children from his first marriage, Michael Martinez and Matthew A. Martinez, both of San Dimas, Calif., Diane Mandaville of Tigard, Ore., Susan Baker of Apple Valley, Calif., and Carol Gomez-Jungwirth of West Covina, Calif.; a brother; two sisters; 15 grandchildren; and three great-grandchildren.

In 1982, California Democrat George E. Danielson resigned from his U.S. House seat after being appointed to the California Court of Appeal. Rep. Martinez won the special election for Danielson’s seat in a largely Latino area.

In a general election five months later, Rep. Martinez successfully defended his spot against John Rousselot, a congressman who lost his California seat to redistricting and who was a former John Birch Society member.

When Rep. Martinez first took office, he was the most junior member in the House of Representatives. Considering his rise, Rep. Martinez said he was not bothered by his tiny office and the fact that it was the least accessible on Capitol Hill.

“When you think about it,” he told the New York Times in 1982, “where I started out, in the East L.A. ghetto, this really is the fulfillment of the American dream.”