The American public is unusually pessimistic about the direction of the country and increasingly fed up with Washington gridlock, a sour mood reflected in the worst disapproval ratings for President Obama since he took office nearly five years ago.

People give elected officials unusually low grades — 31 percent rated them D and 38 percent gave them an F, according to a new McClatchy-Marist poll.

“The lack of confidence in Washington to right itself is showing up,” said Lee Miringoff, director of the Marist Institute for Public Opinion in New York.

Obama’s disapproval rating climbed to 53 percent — the worst in 29 polls since he took office in January 2009 — while 43 percent approved of his job performance. The disapproval number was up sharply from the 47 percent reading in September.

Obama retained strong support among Democrats — 77 percent approval — and disdain from Republicans — 90 percent disapproval. Independents disapproved 56 percent to 41 percent.

Obama’s personal ratings were also down. By 52 percent to 46 percent, people said they had an unfavorable impression of him.

Congress fared even worse. Republicans had a 74 percent disapproval rate. Republicans control the House of Representatives and 45 of the Senate’s 100 seats.

People soured on Democrats, too, giving them a 64 percent disapproval rating.