Sen. Pat Roberts (R-Kan.) answers a question during a debate with independent candidate Greg Orman last month. (Charlie Riedel/AP)

Pat Roberts has been a Kansas Republican in good standing going back generations. His abolitionist great-grandfather arrived in the state with a six-gun and a Bible, founding the state’s second-oldest newspaper. His father was chairman of the Republican National Committee during the Eisenhower years.

Somehow, after all that history and more than three decades in Congress, Roberts is in trouble with Kansas voters, some of the most Republican in the country.

After arriving in the House in 1981, Roberts devoted himself almost exclusively to matters of agriculture, a deeply home-state concern, allowing him to boost the interests of Kansas wheat farmers. Each year, he took a two-week trip in a beat-up van to visit all 66 counties in his district, which sprawled across the prairie of western Kansas.

The Almanac of American Politics, sacred to insiders, summarized that history as “fine Kansas Republican background.”

But after 16 years in the House and 18 years in the Senate, the Pat Roberts of old has disappeared in his bid for a fourth Senate term. Now he’s battling the idea that he’s more Washington than Kansas.

Roberts gestures to the crowd as he rides on the back of a pickup in a parade in Gardner, Kan., this summer. (Charlie Riedel/AP)

He has been ridiculed in campaign ads for not owning a home in Kansas, and, perhaps more important, he shifted his focus away from agriculture — Kansas’s bread-and-butter issue — to intelligence matters after the 2001 terrorist attacks. Those issues have gained him clout in the capital’s corridors of power but have created a a big hole in his résumé on home-state issues over the past decade.

Several recent polls find Roberts trailing independent candidate Greg Orman, 45, who was virtually unknown two months ago, and he is struggling to explain to voters that, despite their current impression, he has spent his decades in Washington fighting for them.

If he has caught Washington fever, he tries to explain, it is because that is where Kansans wanted him to focus his energy.

“I know more about Kansas than anybody else on this stage,” the 78-year-old said during a September debate. “I am a fourth-generation Kansan. I was born here, educated here, done my life’s work here. Don’t tell me I’m not from Kansas. The people of Kansas elected me to go to the U.S. Senate. The U.S. Senate is in Washington.”

The seat Roberts holds has been in Republicans hands since 1919, and a loss could cripple the GOP’s chances of reclaiming control of the Senate, which Democrats have held for eight years.

Despite his longevity and seeming invulnerability, Roberts entered this election campaign with a major problem: Many voters in Kansas had no clue what he had done in Congress. Roberts was “one of the most anonymous senators in the country,” according to a February 2013 poll by a Democratic-leaning firm.

More voters approved of his job performance than disapproved, but about 40 percent had no opinion of Roberts, according to Public Policy Polling. Some experts question the reliability of that firm’s automated polling, but its finding demonstrated that a huge portion of Kansans saw their longest-serving officeholder as a blank slate. The only other senator to have made such an unformed impression had been in office just two years.

Roberts, who spent five years running an Arizona newspaper after leaving the Marine Corps, first arrived in Washington in 1967 to work for an Arizona congressman. Two years later he was hired by Rep. Keith Sebelius (R), the congressman who represented his home town in Kansas and the father-in-law of future Kansas governor Kathleen Sebelius.

When his boss announced retirement plans in 1980, Roberts jumped into the primary to succeed him. He won with 56 percent of the vote; that remains the lowest share of the vote he has received in any election.

In Congress, the committee assignments were simple: Agriculture and Oversight. His focus was defending wheat farmers, and once Republicans claimed the House majority in 1994, Roberts became Agriculture Committee chairman. He co-wrote the “Freedom to Farm Act” of 1996, which was designed to wean agriculture interests off federal subsidies. But Roberts has championed increases in crop insurance programs ever since, rather than the emergency farm bailouts that became a regular occurrence after his 1996 bill.

From the Oversight Committee, he led a task force exposing scandals at the House post office and restaurants in the early 1990s. He later served as the top Republican on the Ethics Committee.

In 1996, with a rare Senate seat from Kansas opening up, Roberts ran on his farm expertise and easily won, continuing his agriculture-first focus. By 2002, he was the most popular politician in Kansas. Democrats did not even mount a challenge, and he won reelection with 83 percent of the vote as fringe candidates collected the remaining ballots.

With the nation at war, Roberts then shifted his policy focus. Republicans were in the majority in the Senate, and he began his second term by claiming the chairmanship of the Intelligence Committee.

That gavel brings prestige in Washington. The chairman gets meetings inside the deepest bunkers of CIA headquarters in Langley, Va., learns secrets that only a dozen lawmakers are entitled to hear and receives countless invitations to the Sunday political talk circuit. The wars in Afghanistan and Iraq made the committee’s work even more prominent than before, and Roberts dived in.

Two years later, Roberts faced a wonderful predicament: He could remain as the Senate’s top spy, or he could become Agriculture Committee chairman, in advance of a new farm bill that would give him enormous opportunities to boost Kansas farmers and agricultural interests. He chose the Intelligence Committee. That allowed a junior Southern senator with vastly different crop allegiances, Saxby Chambliss of Georgia, to oversee the agriculture panel.

Roberts became one of the highest-profile defenders of the George W. Bush White House’s handling of the wars and its controversial anti-terrorism methods. He fought with the Intelligence Committee’s top Democrat, Sen. John D. Rockefeller IV (W.Va.), turning the usually cloaked bipartisan panel into a public sniping ground that punctuated the tense era.

Democrats forced a rare closed-door session of the entire Senate in late 2005, accusing Roberts of stonewalling an investigation into how Bush advisers used intelligence reports in the run-up to the Iraq war. “The very independence of the United States Congress as a separate and co-equal branch of the government has been called into question,” Rockefeller told reporters at the time.

Back home, most of his anti-terrorism work fell on deaf ears, politely applauded by conservatives who support a strong defense and largely overlooked by the rest.

In 2011, with his term on the Intelligence Committee expired, Roberts finally asserted his seniority and became the ranking Republican on the Agriculture Committee. He worked hand in hand with Democrats to produce a new farm bill that preserved his favored crop insurance program, with new payment limits, and also eliminated $5 billion in direct payments to other farmers.

The bill fell apart in negotiations with the House, however, and in 2013, Sen. Thad Cochran (R-Miss.) bumped Roberts from the top committee spot.

Cochran tilted the new version of the farm bill toward Southern rice and peanut farmers, prompting Roberts to vote against what is usually a sure thing for a Kansas congressman. It also came as he faced a conservative tea party challenge in the 2014 Republican primary, and his no vote allowed Roberts to appear fiscally prudent.

Once he cleared the primary, Roberts seemed ready to rely on his decades-long service to the state and its agriculture industry to coast to reelection. The Kansas Farm Bureau declared that “farmers and ranchers in this generation, and the next,” had Roberts to thank, happily endorsing him despite his no vote on the farm bill.

But many voters, of all generations, do not seem to know what those accomplishments are. The controversy surrounding his residence served as a symbolic gateway to questioning his commitment to Kansas.

By September, with Roberts sagging in the polls against Orman, Republicans in Washington sent in a new team to try to right the ship — which, to some, only reinforced the idea that his real value was in Washington, not in Kansas.

“Well, it’s nice that he could bring in some of his neighbors to help him win this race,” Orman said jokingly in a debate.