When they were each running for president in 2015, Donald Trump and U.S. Sen. Lindsey Graham routinely ridiculed each other on the campaign trail, but they have become golfing buddies and frequent political allies in the two years since Trump moved into the White House.

Graham, a Republican from Seneca, supported Trump's effort to cut taxes and won national attention for his impassioned defense of Brett Kavanaugh, the president's Supreme Court nominee.

Just days ago, however, South Carolina's senior senator chided Trump for canceling U.S. House of Representatives Speaker Nancy Pelosi's trip to Afghanistan. Trump's move came one day after Pelosi suggested postponing his State of the Union address, citing potential security concerns stemming from the federal government's partial shutdown.

“One sophomoric response does not deserve another," Graham said.

U.S. Sen. Lindsey Graham speaks to the media in Greenville on Tuesday about his proposal to end the federal government's partial shutdown.(Photo11: Kirk Brown/Independent Mail)

An opinion piece in The Wall Street Journal and an analysis in The Washington Post, both published this month, have sought to make sense of the ups and downs in the relationship between Trump, who is popular among South Carolina Republicans, and Graham, who is the new chairman of the Senate Judiciary Committee.

"It's not really complicated at all," Graham told reporters who gathered Tuesday in his cramped office in downtown Greenville. "I am going to help him where I can. I want him to be successful.

"But sometimes I won't agree with the president."

Trump's refusal to let Pelosi use a military aircraft to visit U.S. troops in Afghanistan is an instance where he and Graham parted ways.

"I thought the whole idea of stopping the speaker's travel to Afghanistan was not a good precedent to set because I want every member of Congress who is willing to go to go," Graham said. "I just met with our Afghan commander in Pakistan a couple of days ago. The government may be shut down, but the war is sure not."

Graham also described Pelosi's threat to postpone the State of the Union as "beyond sophomoric."

"I think most Americans believe we can do better than this," he said. "Count me in."

A rough start to their relationship

They come from such different backgrounds, Graham and Trump.

Graham is a 63-year-old bachelor who speaks with a Southern drawl. He grew up in Central, where his parents ran a pool hall and liquor store. After they died, he helped raise his younger sister.

A lawyer and retired Air Force officer who was awarded the Bronze Star, Graham has spent 25 years in elected office. His campaign for the White House lasted only about six months in 2015.

Trump, 72, is from Queens, New York. The thrice-married real-estate mogul hosted "The Apprentice" reality television show before making his first foray into politics when he ran for president.

President Donald Trump(Photo11: USA TODAY NETWORK)

Perhaps the best-known clash between Graham and Trump happened in July 2015, about a month after Trump entered the crowded Republican race.

Upset about derogatory comments that Trump had made about his friend, U.S. Sen. John McCain, Graham called Trump a "jackass" three times during an appearance on "CBS This Morning."

Trump fired back a few hours later during a campaign stop in South Carolina, Graham's home state. He called Graham "an idiot" and then gave out his cellphone number.

Graham responded the next day with a tongue-in-cheek video illustrating various ways to destroy a cellphone.

The relationship continued to be bumpy during the months after Trump took office.

After a violent August 2017 rally in Charlottesville, Virginia, Graham slammed Trump for "suggesting there is moral equivalency between white supremacist neo-Nazis and KKK members" and Heather Heyer, the woman who died when a car plowed into a group of counter-protesters.

"Your words are dividing Americans, not healing them," Graham said in a statement.

In a tweet, Trump described Graham's remarks as a "disgusting lie."

"He just can't forget his election trouncing," Trump added. "The people of South Carolina will remember!"

But by October 2017, Graham had joined Trump on the golf course, and they have played together several times since then. He has repeatedly praised the president for seeking to increase military funding and the ongoing efforts to prevent North Korea from developing a nuclear weapons program.

'I'm going to keep being Lindsey Graham'

Graham told members of the media on Tuesday that he is scheduled to meet with Trump in the White House on Wednesday.

Graham said he will outline a proposal that he hopes will end to the government shutdown that has lasted for more than a month. He said he would ask Trump to re-open shuttered federal agencies if Pelosi agrees to take up a bipartisan Senate bill dealing with funding for a border wall and other immigration issues.

He also said he would brief Trump on his recent trip to Turkey, which borders war-torn Syria. Graham has been wary of Trump's plan to pull American forces out of Syria.

"If we just withdraw and don't think about what comes next, we're making a huge mistake." said Graham, who wants to see an international force create a safe zone separating Turkey from Kurdish fighters in Syria.

As he prepared to head back to Washington, Graham was asked about a recent tweet posted by U.S. Rep. Illhan Omar, a freshman Democrat from Minnesota.

"They got to him, he is compromised!" she tweeted on Jan. 15, when she included video of Graham bashing Trump in a televised interview as if to imply there is an unspoken reason Graham now often sides with Trump.

Omar spoke about the tweet during an appearance on CNN two days later. She said her opinion is based on observations, not evidence.

"So over the last three years, we have seen many times where Sen. Lindsey Graham has told us how dangerous this president could be if he was given the opportunity to be in the White House. And all of the sudden, he's made not only a 180 turnaround but a 360 turnaround. And so I am pretty sure that there is something happening with him," she told CNN. "He is somehow compromised to no longer stand up for the truth and to make sure that he is fighting to protect the oath that he took in serving the American people."

Graham said he "has no idea why people say things like that, but this is the world in which we live in."

"I am trying to do my best to solve problems that somebody needs to solve," he said.

He said Omar's "approach to politics is not going to change the way I do business."

"I know who I am and what I believe," he said. "I'm going to keep being Lindsey Graham, and I'm not going to be deterred by people who know nothing about me saying things (when) they don't know what their talking about."

Follow Kirk Brown on Twitter @KirkBrown_AIM and email him at kirk.brown@independentmail.com