Moody's Investors Service stripped the United Kingdom of its triple-A credit rating, predicting economic weakness will weigh on public finances for years to come.

Moody's lowered the U.K.'s domestic and foreign-currency bond rating one notch to Aa1 and changed its outlook to stable. It is the first of the three major ratings firms to do so, though both Standard & Poor's Ratings Services and Fitch Ratings have the U.K. on negative...