I am often asked why, in a country of such talent and imagination, the U.S. political class is so feeble. Why are our politicians so uninspiring, to say nothing of ignorant and oafish?

The short answer is because political life is awful, and potential candidates have to weigh the effect on their families plus the wear and tear of becoming a candidate, let alone winning.

I would name three barriers that keep good people out of politics: the money, the primary system and the media scrutiny.

Taking these in order, you must have access to enormous funding to be a candidate. Mr. Smith, the character in the 1939 movie “Mr. Smith Goes to Washington,” was appointed. He didn’t have to subject his rectitude to the electoral process.

A candidate for Congress must get substantial funding from the outset and be prepared to spend much of his or her career raising money, which frequently means bending your judgment to the will of donors. Yes, Mr. Smith, to some extent, the system is inherently corrupt.

I asked a prominent political consultant what he asks a candidate before going to work for him or her. First is money: Do you have your own, or can you raise it? Second are skeletons in the closet: Have you been arrested for indecent exposure or drunk-driving offenses?

Finally, the consultant told me, he asks a candidate: What do you stand for? In short, the mechanisms of politics triumph over principles. A member of the House once told me that he spent much of his time meeting with donors and attending fundraisers. “You’ve got to do it,” he said.

In the days of the smoke-filled rooms (there really was a lot of smoke), the party — the professionals — prevailed. In the primary system, the odds are on those who are extreme and appeal to the fringes of their party ideology. The party doesn’t shape today’s candidates; they shape the party.

Look at the Republicans, little recognizable from the party of old; the party that was held in check by the New England stalwarts. Or look at how the Democrats fight to avoid falling into the chasm of the far left. Once, the Democrats were held in check by labor, which gave the party an institutional center.

On the face of it, the primary system favors grassroots democracy and the individual. In fact, it favors those with rich friends who will cough up.

Finally, there is media scrutiny. If you want to run for office, you become a public plaything. Everything you ever wrote or said can and will be dredged up.

Opposition research operatives will interview old lovers; check on what you wrote in the school yearbook; rake through your social media posts; and that unfortunate slip of the tongue in a local television interview years ago will be reprised on the evening news. You have a target on your back, and it will be there every day you are in office.

This delving into every corner of life is a huge barrier that keeps a lot of talent out of politics. Anyone who has ever had a disputed business dealing, a DUI arrest (not even a conviction) or a messy divorce is advised to forego a political career, no matter how talented and how much real expertise Mr. Smith might bring to the statehouse or Congress.

Run for political office, and you put your family at risk, your private life on display and, having been hung out to dry, you may not even win.

These are some of the factors that might explain why Congress is so risible and why such outrageously fringy people now occupy high office.

Having observed politics on three continents, I am firmly of the belief that it needs strong institutions in the form of local political associations and party structure, and candidates should be judged on the body of their work, not on a slip of the tongue or an indiscretion.

However, the selection of candidates is always a hard call. If parties have too much control over the system, party hacks are favored and new, quality candidates are shut out.

If primaries continue as they have, the fringes triumph. Just look at the Congress — a smorgasbord of wackiness.