MANHATTAN — U.S. Sen. Pat Roberts, an unapologetic Republican and champion of Midwest agriculture, said Friday he wouldn't seek a fifth term and intends to retire at close of a 40-year career representing Kansas in Washington, D.C.

"I am announcing I will serve the remainder of this term as your senator fighting for Kansans in these troubled times," Roberts said. "I intend to sprint to the finish line."

"Never in my wildest dreams did I think I would become the longest-serving member of Congress in our state's history," he said.

Standing in the lobby of the Kansas Department of Agriculture, near the campus of his alma mater, Kansas State University, the senator committed to staying in the Senate through the 2020 election cycle rather than departing early.

Roberts, who ranks ninth in seniority in the Senate, would exit the federal government in January 2021 as winner in two dozen primary and general elections. He never lost a campaign.

"I'm damn proud of that undefeated record, and it's all thanks to a strong partnership in government with the good people of Kansas," Roberts said.

His retirement is expected to set off a scramble in the Republican and Democratic parties ahead of elections in two years. U.S. Rep. Roger Marshall, who represents Roberts' former House district, and U.S. Secretary of State Mike Pompeo, a former congressman from Wichita, have been noted as potential GOP candidates. In the Democratic Party, former federal prosecutor Barry Grissom has expressed interest.

Roberts declined to identify anyone he preferred to run for the seat, twice indicating Republicans had a deep roster of capable replacements. The senator did mention former U.S. Sen. Bob Dole had jokingly expressed interest in the job during a phone call prior to the public announcement.

In response to reporters' questions, Roberts said he was puzzled by officials who insisted on shutting down part of the federal government in a feud about spending for more barriers along the border with Mexico. President Donald Trump requested more than $5 billion for the job, while House and Senate Democrats have held at zero. Roberts said shutdowns rarely, if ever, achieved goals set by participants.

"The president feels very strongly that we need border security. It's troubling to me when I see my friends across the aisle not voting for things they have voted for in the past," Roberts said.

Roberts, who was an officer in the U.S. Marine Corps, said he was concerned about the evolution of national security policy amid resignations by Defense Secretary Jim Mattis and White House Chief of Staff John Kelly. Both men were generals in the Marine Corps.

"We need a consistent and predictable national security policy that is in step with our allies," the senator said. "And when we make decisions, it should be a step-by-step process where everybody is informed using the very best intelligence that we have."

Roberts, 82, discussed career options with supporters and family over the holidays before reaching a final decision that he had pledged would be revealed early this year. Standing next to his wife, Franki Roberts, he choked up briefly while speaking about the role family — including three children and seven grandchildren — played in his political career.

"I'm proud of him," Franki Roberts said. "I think it's a good decision. It's kind of an emotional moment. I'm proud of him."

Kansas' seats in the U.S. Senate have long been considered safely Republican, and Roberts has said he wasn't worried about GOP or Democratic challengers in 2020. No Democrat has won a Senate campaign in the state since the 1930s.

Rural issues were at the core of his agenda since elected in 1980 out of Dodge City to represent the heavily Republican "Big First" district of western Kansas in Congress. In December, he completed work on a new federal farm bill while serving as chairman of the Senate's agriculture committee.

Roberts has been in the Senate since replacing Nancy Kassebaum in 1997, while Republican U.S. Sen. Jerry Moran in 2011 took the seat previously held by Sam Brownback.

Roberts was re-elected in 2014 by defeating Milton Wolf by 7.3 percent in the GOP primary and independent Greg Orman by 10.7 percent in the general election.

Kansas' political landscape shook in November when voters elected Democratic Gov.-elect Laura Kelly and U.S. Rep. Sharice Davids, D-Kan. Democrat Paul Davis nearly won the 2nd Congressional District seat. If Roberts were to run again in 2020, he could be on the ballot with President Donald Trump, who fared poorly in vote-rich Johnson County.

Roberts has been a pro-life conservative who opposed same-sex marriage and maintained an "A" rating from the National Rifle Association. He has been a vocal critic of the Affordable Care Act signed by President Barack Obama. One of the top accomplishments of his career was bringing to Kansas the National Bio and Agro-Defense Facility, which will conduct research on lethal animal-borne diseases.

He celebrated his work on the 2018 federal Farm Bill and service on the Dwight D. Eisenhower Memorial Commission. He proposed opening the Arctic National Wildlife Refuge to drilling for oil and urged Trump to withdraw the U.S. from the Paris climate agreement.

Roberts was born in Topeka and raised in Holton. He graduated from Kansas State, served as a Marine Corps captain and worked at Arizona newspapers until he was hired in 1967 to the staff of U.S. Sen. Frank Carlson, R-Kan. He moved two years later to a job with U.S. Rep. Keith Sebelius of the 1st District.

He was easily elected to the U.S. House in 1980 upon retirement of Sebelius, who was father-in-law to former Democratic Gov. Kathleen Sebelius. Roberts was the first federal lawmaker to lead the agriculture committees in both the U.S. House and U.S. Senate.