A key measure of U.S. housing affordability is nearing its first deterioration in almost three years, as rising borrowing costs force homebuyers to devote a larger share of their income to housing payments.

According to data released Thursday by the National Association of Home Builders (NAHB) and Wells Fargo, monthly mortgage payments on a median-priced new home of $410,700 accounted for 34% of a typical household’s income in the second quarter, up from 32% in the previous quarter.

During the quarter, the U.S.-Iran war pushed borrowing costs higher across the economy. The average rate on a 30-year fixed mortgage climbed sharply and is now near a one-year high of approximately 6.8%. The median price of a new home also increased 2% from the previous quarter, further straining affordability.

“Homebuyers are confronting high mortgage rates and economic uncertainty, while builders are dealing with rising construction costs, unnecessary regulatory burdens and labor shortages,” NAHB Chairman Bill Owens, a homebuilder from Ohio, said in a statement.

The NAHB calculation is based on a median annual household income of approximately $107,000. For households earning only half that amount, mortgage payments on the same new home would consume 67% of their income, highlighting the severe affordability pressure facing lower- and middle-income buyers.