Hillary Clinton and President Obama campaign appear together at a rally in Charlotte on July 5. (Melina Mara/The Washington Post)

When President Obama and Hillary Clinton campaigned together for the first time recently, the collection of staff members milling around the sidelines at the Charlotte Convention Center represented a final melding of two formidable political machines. Obama once portrayed Clinton as the past of the Democratic Party and himself as its future. Now, as they try to bind one precedent-setting presidency to another, they see their ambitions as inextricably linked.

Near a bike rack behind the stage in Charlotte stood Clinton’s campaign chairman and her communications director — John D. Podesta and Jennifer Palmieri — both of whom left the Obama White House to take their current jobs. Two other campaign staffers who served in the Obama administration, Jake Sullivan and Huma Abedin, stood in the same area, along with a posse of White House officials who had worked to secure Obama’s 2008 primary victory over Clinton — Jennifer Psaki, Josh Earnest, Ben Rhodes and David Simas.

The early rifts between the two camps, dating to that 2008 primary season, were largely healed early in the president’s first term. But as the current campaign has unfolded, the ­rivalry-turned-alliance has entered a new stage, one in which Obama and his aides are prepared to work doggedly to land Clinton in the White House, which they see as an opportunity to preserve their own work and cement the president’s legacy.

Obama’s speech to the Democratic National Convention on Wednesday will be a centerpiece of that effort. “The president would argue that the job is not yet done,” Psaki, the White House communications director, said in an interview. “The question is who is going to be at the head of the table when we’re winding down this year.”

The collaboration has been a huge boon for the Democratic nominee, but there are liabilities as well. Clinton will lay claim to a stronger economy and expanded health-care coverage in the United States, for example, but voters may also blame her for a chaotic Middle East and a political system seen as rigged in favor of Washington insiders.

“From the very beginning of the creation of the Obama world, there was deep coordination, cooperation and integration with the Clinton world,” said Simon Rosenberg, who heads the liberal think tank NDN. “The degree of integration that happened from the very beginning of this campaign is almost unprecedented in modern American history.”

White House aides now talk to their campaign counterparts several times a week, and Obama’s former campaign manager, David Plouffe, began advising Clinton’s campaign months ago.

“There’s no forced marriage,” said Steve Elmendorf, a longtime Democratic strategist and lobbyist, adding that Plouffe “has become the bridge to all things Clinton.”

No moment crystallized the melding of these two worlds more clearly than when Clinton announced Friday that Sen. Timothy M. Kaine (D-Va.) would be her running mate. Kaine, who endorsed Obama over Clinton in 2007, was the president’s pick for the job, according to an individual familiar with his thinking who spoke on the condition of anonymity to talk about the sensitive subject. Obama believed that Kaine was positioned to govern and serve as a leader of the party.

The president “is quite enthusiastic” about Kaine’s selection, Earnest, the White House press secretary, said Monday, adding the senator’s experience as a missionary in Honduras and a civil rights lawyer is “something that deeply resonates with a president who began his career in public service as a community organizer.”

As the two big factions of operatives and strategists in the party, the Clinton and Obama camps were always working together. Many of the men and women who worked on Hillary Clinton’s 2008 campaign — and worked in her husband’s White House — also helped shape the early days of Obama’s administration. Podesta oversaw the presidential transition, and former Clinton administration officials helped fill out the White House economic team and key agency posts.

Despite occasional past efforts to differentiate herself from the president, Clinton’s current embrace of Obama makes political sense: His favorability rating is now above 50 percent in most polls, he remains a major draw on the fundraising circuit, and he can mobilize key constituencies, such as African Americans, Latinos and young people.

Obama may also able to help unify the party at a time when it is being ripped apart by a scandal involving leaked emails from Democratic National Committee staff. The emails have infuriated supporters of Sen. Bernie Sanders of Vermont, Clinton’s erstwhile challenger for the nomination. Some of the emails confirm suspicions in the Sanders camp that the DNC wanted to help Clinton to victory.

The president “can bring along the left,” said former congressman Barney Frank (D-Mass.), a prominent liberal and Clinton backer. He added that Obama’s endorsement won’t alienate many. “People who hate him are going to vote against her anyway.”

But even as the president’s popularity has edged up — a recent Washington Post-ABC News poll found him with a 56 percent favorable rating — 2 in 3 Americans surveyed said the country is “off on the wrong track.”

“He’s trying to transfer that level of popularity, but at the same time he’s potentially weighing her down with the direction of the country,” GOP pollster ­David Winston said.

Reince Priebus, the chairman of the Republican National Committee, said in an interview Monday that Obama’s push for Clinton reinforces the idea that she’s “the same old Democrat with the same old ideas.”

“If they had a unified party, it would help solidify the base, but there’s a question of what it does in a year when the public wants drastic change in Washington,” Priebus said. “It’s kind of tone deaf to what the American public is looking for.”

Democrats believe that GOP nominee Donald Trump is too extreme for most voters.

In Philadelphia, Obama is set to deliver a speech different from the final convention speeches of some recent two-term presidents. Obama is expected to focus on touting Clinton rather than replaying his own record.

In 1988, Ronald Reagan went on at length about what his administration had accomplished before introducing his vice president’s contribution with the remarkably passive “And George was there.”

Twelve years later, Bill Clinton initially drafted a speech that devoted half its time to promoting Al Gore’s work during their eight years together in office. But in the days leading up to the convention, Gore’s staff insisted on jettisoning most of those references, according to Clinton speechwriter Jeff Shesol, because they feared the “toxicity” stemming from the president’s affair with intern Monica Lewinsky would taint the vice president.

By the final draft, Shesol estimated, “it was close to 90-10” between Clinton and Gore references, “entirely at their direction.”

President George W. Bush did not attend the 2008 GOP convention, although he delivered remarks by satellite.

Carter Eskew, who ran messaging and advertising for Gore’s 2000 campaign and is now managing director of the strategic communications firm Glover Park Group, said there is little question that “Obama truly wants to help Clinton” through his convention speech and a raft of coming campaign and fundraising appearances. But he added one cautionary note.

“Even if he wants to,” Eskew said, “it’s not a guarantee that it will work.”