By JOSH BOAK, AP Economics Writer

WASHINGTON (AP) — A college degree practically stamped Andres Aguirre's ticket to the middle class. Yet at age 40, he's still paying the price of admission.

After a decade of repayments, Aguirre still diverts $512 a month to loans and owes $20,000.

The expense requires his family to rent an apartment in Campbell, California, because buying a home in a decent school district would cost too much. His daughter has excelled in high school, but Aguirre has urged her to attend community college to avoid the debt that ensnared him.

"I didn't get the warmest reception on that," said Aguirre, a health care manager. "But she understands the choice."

America's crushing surge of student debt, now at $1.2 trillion, has bred a disturbing new phenomenon: School loans that span multiple generations within families. Weighed down by their own loans, many parents lack the means to fund their children's educations without sinking even deeper into debt.

Data analyzed exclusively by The Associated Press, along with surveys about families and rising student debt loads, show that:

— School loans increasingly belong to Americans over 40. This group accounts for 35 percent of education debt, up from 25 percent in 2004, according to the New York Federal Reserve. Contributing to this surge: Longer repayment schedules, more midcareer workers returning to school and additional borrowing for children's education.

— Generation X adults — those from 35 to 50 years old — owe about as much as people fresh out of college do. Student loan balances average $20,000 for Generation X. Millennials, who are 34 and younger, have roughly the same average debt, according to a report by Pew Charitable Trusts.

— Gen-X parents who carry student debt and have teenage children have struggled to save for their children's educations. The average they have in college savings plans is just $4,000, compared with a $20,000 average for teenagers' parents who aren't still repaying their own school loans, Pew found. A result is that many of their children will need to borrow heavily for college or pursue cheaper alternatives, thereby perpetuating a cycle of family debt.

— Student debt is surpassing groceries as a primary expense for many borrowers, with the gap widening most for younger families. The average college-educated head of household under 40 owes $404 a month in student debt payments, according to an AP analysis of Fed data. That's slightly more than what the government says the average college-educated family spends at the supermarket.

The multigenerational debt cycle reflects a rush to pursue college as a path to middle class security. Roughly 25 years ago, federal policies began to encourage borrowing on a mass scale to cover soaring college costs. Policymakers figured that borrowers could afford the debt because college degrees would all but guarantee comfortable incomes.

The reality played out somewhat differently.

Roughly 6 million Gen-X households still owe student debt. Some, like Aguirre, are forgoing home ownership. Others have moved to remote stretches of the country to qualify for loan forgiveness programs.

Repayment has increasingly required financial sacrifices because as college borrowing has climbed, earnings have stagnated for people with only bachelor's degrees, according to data provided by Georgetown University. Successful careers increasingly require graduate degrees — and thus, ever larger debt loads that take longer to repay. At no point in the past, experts say, has such a large share of the U.S. population begun their careers indebted.

"We've never had a historical era where so much debt was taken out at an early age," said Diana Elliott, research manager for financial security and mobility at Pew.

— DIFFERENT PATHS

Nathan Anderson received his first student loan in 1991. His time at Johns Hopkins University overlapped with the start of the lending boom: The government was raising borrowing limits, introducing unsubsidized Stafford loans and incentivizing private lenders.

Such policy moves were supposed to make college affordable for students regardless of their parents' incomes. But the wider availability of debt instead helped fuel rising tuitions, according to research this year by the New York Fed.

Majoring in psychology, Anderson hoped to become a child psychologist. But after suffering a shoulder injury while playing soccer, he found relief only from an acupuncturist. The treatment led him to study Chinese medicine after graduation and become a licensed acupuncturist himself in 2004. He had already racked up $45,000 in college debt; acupuncture school required more.

Now 42 with a blended family of five, he runs an acupuncture clinic in Tucson, Arizona, with his wife, Julie, also an acupuncturist. Combined, their monthly student loans bills approach $1,700.

"More than we spend on groceries and kind of like having a second mortgage," Anderson said.

The push to borrow that began in the 1990s was premised on the notion that virtually every degree — regardless of the school or the major — could more than pay for itself because college graduates would command premium incomes, explained Peter Cappelli, a management professor at the University of Pennsylvania and the author of "Will College Pay Off?"

That's not necessarily how it turned out.

Many students, like Anderson, recast their career goals — a shift that compelled them to take on more debt.

And even as the debt loads climbed, median income for college graduates has stagnated. A recent college graduate in their 20s earned about $41,000 in 2013, or $2,000 less in current dollars than in 1970, according to figures from the Georgetown University Center on Education and the Workforce. That same pattern continues for workers with only a college degree in their 30s and 40s.

"If the debt is not paying off for the parents," Cappelli said, "they don't have the money to support their kids."

Indeed, Anderson says his family's debt loads have inhibited their college savings. For his two teenage stepsons, he and his wife have discussed more affordable college options, such as starting at a two-year school. It's a prospect that leaves Anderson conflicted because it means limiting their child's education and career options.

"It's not only going to affect the next four years but the next 34 years," he said.

— NO CHOICE

Until recently, few researchers had explored the relationship between parents' student debt and meager college savings for their children.

In July, Pew Charitable Trusts provided a glimpse.

Gen X parents with student debt managed to set aside just $4,000 in college savings plans. That would cover less than half a semester's tuition at a typical public university. Pew's report warned that parents' student debt loads "could fuel an intergenerational legacy of debt" within families.

The survey found that loan balances averaged $20,000 for both Generation X and younger millennials — a surprising finding given that many Gen X-ers have worked for more than a decade and might be expected to have repaid much of their debt. Yet many Gen X-ers have felt compelled to return to college or attend graduate school to improve their earnings prospects. To do so, they've had to borrow at a time in life when savings traditionally became a priority.

Consider Ernie Rosales, who returned to college in his 30s. He felt he had maxed out his potential income in California's aerospace industry with a pair of associate degrees.

Earning a bachelor's degree at Azusa Pacific University in 1999 enabled him to pivot into information technology. Two years later, Rosales returned to school and obtained a master's degree to further enhance his earnings power.

"You reach a certain level in the corporate world you cannot go above without a bachelor's or master's," explained Rosales, 52, wearing his college class ring.

But the combined debt left him with a shortage of savings for his three daughters' educations. Two are on the verge of graduating college with debt. A third, in high school, excels at ballet and is starting to look at universities.

Each month, $1,500 is deducted from the family bank account for student loans. It's more than their mortgage. The withdrawals include about $500 a month to repay his college and grad school debt — debt that felt unavoidable if he wanted to provide enough for his family.

"Neither of us really likes debt," said Rosales' wife, Jill Rosales. "But to some degree in the United States, it's just a part of living here. There's some debt that you have to take on to get ahead."

— HIGHER DEBT, FALLING PAY

Much of the problem is that student loans are essentially bets on future income, secured on the faith of a lucrative career ahead. But as a group, only workers with advanced degrees have enjoyed inflation-adjusted pay increases.

The median income for a 30-something with a graduate degree is $70,000. This marks a decent jump from an inflation-adjusted salary of $66,921 in 1970, according to Georgetown figures.

That said, a master's degree requires an average debt load of $41,400, according to the Education Department — in addition to the average of $27,300 borrowed separately for a bachelor's.

"This is one of those Catch-22's," said Anthony Carnevale, director of the Georgetown University Center on Education and the Workforce. "If you don't take out the debt, you don't get the earnings. And you need the earnings to repay the debt."

Back in 2001, the Fed studied the student debt of college-educated households younger than 40. These were largely the Generation X-ers, many still managing college bills. At the time, this group owed an inflation-adjusted $3,760 a year in payments.

By 2013, when the Fed examined millennials and the tail end of Generation X, the borrowing cycle had worsened: More was owed. The survey suggested that the debt burden would likely be magnified for millennials and their children. The average sum owed in 2013 — $4,850 — exceeded what college graduates spent that year on auto-loan bills or groceries, according to government data.

— ECONOMIC SECURITY FADES

Many parents with debt have made extreme sacrifices to contain their loans and their children's.

In Kansas, Jonathan Bigler, 54, decided to leave teaching to become a physician's assistant in 2001. It meant taking on loans shortly before his three children would enter college.

After graduating, Jonathan and his wife, Lori, 51, also a teacher, had to move to the remote town of Ashland as part of a government-backed program to forgive the debt. With a population of 853, Ashland is 50 miles from the nearest Wal-Mart and an hour from hamburgers at the closest Sonic Drive-In.

After a decade and a sizable consolidation, the Biglers write checks totaling $2,531 each month to repay student debts for the physician assistant's degree, her teaching credentials and the college degrees of their daughters, ranging in age from 22 to 27. They are happy with their lives. Yet they feel stressed to know they are on track to be repaying debts until Jonathan turns 72.

"We don't have the security that we would like to have," said Lori Bigler. "We feel like we are in servitude and would be living a complete different life without the games that came along with the student loans."