Timothy M. Kaine was feeling bummed by the time he walked into the fundraiser he was hosting with his friend and political partner Mark Warner.

Kaine, then Virginia’s governor, was on Barack Obama’s shortlist to become the Illinois senator’s vice-presidential nominee. But Kaine had seen a news report that “repeated the ‘no significant accomplishment’ line” about his tenure in Richmond, as he would later put it in a memo to his staff, and was “in a down mood.”

Things got worse. At the event, Kaine noticed the enthusiastic applause reserved for Warner, Kaine’s predecessor as governor who was running for Senate, as he listed the accolades that had rolled into Virginia during his tenure — best-managed state, best state to do business, best state for children. Yet Kaine’s Virginia had won the same awards.

“Why is that an accomplishment when Mark talks about it, but not for us?” Kaine thought to himself, according to the memo.

Kaine was right to be worried. His experience had emerged as an issue in the vice-presidential selection process, in part because Obama, then a first-term senator, was already facing criticism about his own lack of achievements.

Kaine was “too much like Obama. Young, only halfway through his term as governor,” recalled David Axelrod, Obama’s top strategist at the time. “Obama knew he needed someone more senior.”

Circumstances would be far different eight years later, as a more seasoned Kaine, now a 58-year-old U.S. senator known in part for his work on the Foreign Relations Committee, made the cut in Hillary Clinton’s search for a running mate.

On Saturday, Clinton told supporters that Kaine was qualified to step into the presidency “and lead on day one.” She pointed to his tenure as governor to draw a contrast with Donald Trump’s running mate, Indiana Gov. Mike Pence, saying that Kaine prioritized education spending as he guided Virginia through tough financial times.

That’s a long way from how Kaine thought he was seen in 2008, after the vice-presidential search highlighted a dilemma that had nagged him throughout his term as governor: how to be seen as a pragmatic, get-things-done leader while also acting on his partisan impulses.

A review of hundreds of pages of internal records from Kaine’s four years as governor, including emails between Kaine and his top aides, shows him struggling at times to find the right balance between tending to what he called the “Kaine brand,” while also advancing the Democratic Party in a historically conservative state.

His focus on politics, including an all-out effort to deliver Virginia for Obama in 2008 and then his appointment as Democratic National Committee chairman during his final year in office, helped fuel his national rise while hampering his ability to find compromise with a Republican-led legislature at home.

The records, maintained and made public by the Library of Virginia, show how Kaine, stung by the “no accomplishment” criticism that emerged as he was passed over for the national ticket in 2008, redoubled his efforts to try to repair what he felt was an unfair knock on his record.

“We have gotten a lot done . . . But, we all need to work harder to tell the story,” he wrote in a long and reflective memo to his staff a few weeks after Obama tapped Sen. Joseph R. Biden Jr. (D-Del.), recounting his “interesting experience in the midst of the VP buzz.”

That September 2008 memo — which begins “I have 16 months left in my term” — showed that Kaine was eager to accumulate as many accomplishments as he could before Virginia’s constitution forced him from office after four years. Kaine wrote that “we need to fully use all levers of executive power to accomplish our goals” and that his team needed to “start lining up support” for a number of legislative goals.

Kaine used the memo, addressed to the leaders of his office and his political action committee, to explain in clear terms the importance to him of turning the 2008 election into a watershed moment for Virginia. “If we can win the state’s electoral votes for Obama, it will be a huge legacy item for us,” Kaine wrote. “I cannot overestimate the importance of reaching for this goal.”

Kaine did help achieve that goal, but he spent the rest of his term much as he had started it — embroiled in partisan gridlock and unable to resolve ongoing battles with the GOP-led General Assembly.

“He was a placeholder governor,” said former Virginia attorney general Jerry Kilgore, Kaine’s Republican opponent in 2005. “No one can look at that time and come up with anything that was really his.”

One of the things that Kaine most wanted to be his was a plan to fix the state’s infrastructure, which was crumbling from age and straining from rapid population growth.

Six days after taking office in 2006, Kaine proposed a series of tax and fee increases to pay for improvements. Anti-tax Republicans in the Virginia House were dead set against the idea, but Kaine lobbied for it for months. The result was a budget deadlock that forced the longest legislative session in Virginia history. Facing the threat of a government shutdown, Kaine conceded — agreeing to a budget without his taxes.

He took a different approach the following year, choosing to let Republican and Democratic allies in the legislature take the lead on the issue while he remained largely on the sidelines. Kaine avoided direct combat, but his approach gave critics an opportunity to mock him as a marginal figure.

At one point, Republican lawmakers summoned Kaine’s top aide to the floor of the legislature to present him with a “gift” for Kaine: a rocking chair befitting a governor who negotiated like a “porch-sitter.”

“They thought it was hilarious. I was standing there, humiliated,” recalled William Leighty, Kaine’s chief of staff at the time.

Kaine was so livid that some lawmakers felt the need to make personal apologies. He waded into the debate and agreed with the legislature on a plan that would allow congested regions of the state to raise taxes for their own roads. The plan was later invalidated by the Virginia Supreme Court because of a provision inserted by his staff.

Kaine’s partisan approach was evident amid a public uproar over a plan to increase the cost of some traffic tickets, a GOP plan that he had approved.

Kaine counseled calm to a jittery aide — and suggested that the public fury could turn out to be “helpful in November” in defeating Republicans. He was not on the ballot that year, he noted, and while Democratic incumbents seemed likely to be spared damage, “there is great outrage against some vulnerable R incumbents who seemed unbeatable.”

Kaine supporters say that despite his battles with Republicans, the governor demonstrated effective leadership.

He was a visibly calming presence after a gunman killed 32 people and then himself at Virginia Tech in 2007, hurrying back from a trade mission in Japan to deliver a moving address at a campus convocation. He also spent long hours on the phone comforting family members of the victims.

Kaine ordered a comprehensive review of how the university, including its mental health system and its police responders, had handled the shooting. When the report was completed, the governor locked himself in his office on a Saturday with a diet Dr Pepper and read each word, frequently in tears, according to Wayne Turnage, Kaine’s chief of staff at the time.

He pushed for new funding for mental health institutions and signed an executive order making it more difficult for people who had been involuntarily committed to get guns. He pushed the legislature to close what is called the gun-show loophole, which allows some private sales of guns without background checks, but it was not approved.

Supporters say Kaine also found ways to score legislative victories. He won a ban on smoking in restaurants in 2009, a public-health victory surprising in a state whose economy has been closely linked to tobacco farming since Colonial days. The measure was crafted through weeks of negotiations between Kaine and his frequent House antagonist, Speaker William J. Howell (R-Stafford), and passed on a bipartisan vote. Howell declined to comment.

Kaine was somewhat constrained by factors outside his control. Legislative Republicans were determined not to give another Democratic governor the kind of popularity enjoyed by Warner.

The national recession at the end of Kaine’s term meant the need for massive budget cuts — and no money to pursue new programs.

“How do you quantify the skill of wringing billions out of the state budget without crippling education and services?” said Turnage, who recalled him presiding over long, meticulous meetings looking for trims. “That is a skill that often goes overlooked.”

Others said Kaine was recalcitrant in his views in a way that failed to crack the partisan divide.

While Kaine’s pro-free-trade, business-friendly outlook has made liberals anxious in the days leading to his selection as Clinton’s running mate, during his time in state government, he pushed a centrist Democratic Party to the left.

“Everybody says they want compromise in government. But compromise means you have to eat things. I didn’t see him able to eat some things he didn’t like to get things he wanted,” said Del. David B. Albo (R-Faifax), a long-serving moderate who said Kaine was still too liberal for his political support.

That came in part because Kaine was more attuned to a growing base of reliable Democratic voters than Warner before him. Whereas Warner had won back the governor’s mansion in 2001 for the Democrats after eight years by peeling off votes in the state’s conservative rural areas, Kaine had made an explicit appeal to the more liberal suburbs around Washington, the fast-growing areas that have turned the state from a reliable Republican stronghold into a perennial swing state.

After Kaine did not make it onto the national ticket, he urged his aides to focus on winning Virginia for Obama and ensuring he would be succeeded by a Democrat after the state’s 2009 elections. A Democratic victory in the state elections would be a “validation of our success — it will say that Virginians valued our accomplishments enough to want to keep the state moving forward,” he wrote in the 2008 memo.

That outcome would prove elusive, as Democrats lost the governor’s office the following year. But Obama’s 2008 victory was a significant boost for Kaine.

“Old Virginny is dead,” Kaine declared the day after Obama carried the state in 2008, the first Democrat to do so since 1964.

The DNC chairmanship provided Kaine a national platform but did little to improve relations with home-state Republicans.

“The people in my district do consider him to be a part-time governor who is more concerned about raising money to help Democrats on a Washington agenda than he is on pursuing a Virginia agenda,” then-House Majority Leader H. Morgan Griffith, who now serves in Congress, said at the time.

Kaine at times faced competing pressures, balancing the needs to satisfy core Democratic constituencies as national party chairman with his duties as governor.

When conservatives passed a bill in 2009 creating a license plate that read “Choose Life,” with fees benefiting antiabortion pregnancy crisis centers, Kaine wrote to aides that the DNC had received 50,000 emails demanding that he veto the measure.

While Kaine, who is Catholic, had said he was personally opposed to abortion, he had also opposed further restrictions on abortion rights.

Internal records show that, in dealing with the “Choose Life” debate, Kaine made careful calculations as he attempted to walk a political tightrope.

He emailed Turnage that he was leaning toward signing the bill, drafting a statement for public release that would explain how courts had ruled that vanity plates were a form of free speech and that the state was barred from picking and choosing which ones to approve.

His director of communications cautioned that the statement risked drawing more attention to the issue. But Kaine argued that his statement would help “with some of the politics by demonstrating to pro-choice constituencies” that Planned Parenthood, too, could push for a plate.

Despite his political clashes with Republicans, Kaine earned the personal admiration of many of them. After he was announced as Clinton’s pick late Friday, Howell, the Republican state House speaker, described him as an “honorable public servant.” Former lieutenant governor Bill Bolling, also a Republican, said that while he often disagreed with Kaine on policy, he had “tremendous respect for him as a person.”

Former Democratic governor L. Douglas Wilder said Kaine became a better politician and governor after the sometimes-tough term in office.

“I think he learned from that,” he said. “Tim is grounded. He has a stability, in my judgment, that would anchor the ticket in ways that get things done.”

On Saturday, introduced as Clinton’s running mate, Kaine got a chance to brag about all those accolades he watched Warner talk about eight years ago. “We did that during tough times,” he said.

This time, it was Kaine who got the applause.

Karen Tumulty contributed to this report.