MIAMI -- The final major piece of the 49ers’ puzzle fell into place when the Arizona Cardinals selected Kyler Murray with the No. 1 overall pick in the 2019 NFL Draft.

The Cardinals were not the only team in the NFC West that was thrilled with the pick.

Because Arizona went with a quarterback, it left the draft board wide open for the 49ers at No. 2. CEO Jed York says he thought it was possible the 49ers could have a special season after defensive end Nick Bosa became a member of the team.

The 49ers arrived in Miami, site of Super Bowl LIV, on Sunday evening.

But how they got here to play the Kansas City Chiefs for the Lombardi Trophy was years in the making. It started even before the arrivals of general manager John Lynch and coach Kyle Shanahan in 2017.

“We didn’t make every right decision,” York said. “We didn’t make every right draft pick or every right trade or sign the right free agents all the time, but it’s the culmination of it. We’re trying to build the right team, and you have to have a long-term vision.”

It started when then-general manager Scot McCloughan and coach Mike Nolan traded up into the end of the first round to draft Joe Staley in 2007.

This team includes six players who are holdovers from Trent Baalke’s time as general manager with coaches Jim Harbaugh, Jim Tomsula and Chip Kelly.

Most players from the previous regimes did not make it to this point with Lynch and Shanahan. Staley, defensive linemen Arik Armstead and DeForest Buckner, safeties Jimmie Ward and Jaquiski Tartt, and running back Raheem Mostert are among the exceptions.

Mostert is the most interesting holdover. Six teams cut him before he signed with the 49ers. Lynch and Shanahan saw his talent and kept him around. And look at him now.

Mostert went from being a special-teams ace to the team’s top running back. He rushed for a franchise-record 220 yards and four touchdowns in the 49ers’ 37-20 victory over the Green Bay Packers in the NFC Championship Game.

The most significant piece for the 49ers came courtesy of Bill Belichick in the middle of the 2017 season. The New England Patriots opted to deliver backup quarterback Jimmy Garoppolo to the 49ers for a second-round draft pick.

Garoppolo immediately proved to the 49ers he was their franchise quarterback. After a crash course in the 49ers’ offense over several weeks, Shanahan gave Garoppolo his chance to start at the end of the 2017 season. The 49ers were 1-10 when Garoppolo took over. They finished the season on a five-game winning streak.

“If you don’t have a quarterback who can win in big games and big moments, it’s really, really hard to get to this point,” York said. “And Jimmy, obviously, exceeded any expectations in those games that you could ever ask for a player coming into an organization.

“And he’s continued to improve, he’s continued to work, he’s continued to get better. If you don’t have a quarterback, to me, you just don’t have a chance. It was a must.”

Forty-six of the players on the team’s 53-man roster were acquired in the three seasons Lynch and Shanahan had worked together to rebuild a team that had fallen into a state of disrepair under Baalke.

The first round of the 2017 draft provided no help, as defensive end Solomon Thomas, chosen with the No. 3 overall pick, is a rotational player and first-round selection linebacker Reuben Foster was released after a season-and-a-half due to numerous off-field incidents. York said that move was a defining moment in setting the right culture within the organization.

But the 49ers’ personnel got stronger and stronger as they added such undervalued players as tight end George Kittle and linebacker Fred Warner through the draft.

[RELATED: How Shanahan, Lynch make Jed York's job easier]

Key veteran acquisitions, such as fullback Kyle Juszczyk, cornerback Richard Sherman, linebacker Kwon Alexander and defensive end Dee Ford, provided talent and leadership at important positions.

And then the 49ers topped it off with a strong 2019 draft that included Bosa, wide receiver Deebo Samuel and linebacker Dre Greenlaw.

How the 49ers were built

Scot McCloughan/Mike Nolan (2005-08)

LT Joe Staley, 2007, first round

Trent Baalke/Jim Harbaugh (2011-14)

FS Jimmie Ward, 2014, first round

LS Kyle Nelson, 2014, veteran free agent

Trent Baalke/Jim Tomsula (2015)

DL Arik Armstead, 2015, first round

SS Jaquiski Tartt, 2015, second round

Trent Baalke/Chip Kelly (2016)

DL DeForest Buckner, 2016, first round

RB Raheem Mostert, 2016, veteran free agent

John Lynch/Kyle Shanahan (2017-current)

DL Solomon Thomas, 2017, first round

CB Ahkello Witherspoon, 2017, third round

CB C.J. Beathard, 2017, third round

TE George Kittle, 2017, fifth round

QB Nick Mullens, 2017, rookie free agent

RB Matt Breida, 2017, rookie free agent

WR Kendrick Bourne, 2017, rookie free agent

K Robbie Gould, 2017, veteran free agent

DB K’Waun Williams, 2017, veteran free agent

FB Kyle Juszczyk, 2017, veteran free agent

LB Elijah Lee, 2017, veteran free agent

LB Mark Nzeocha, 2017, veteran free agent

DT Sheldon Day, 2017, waiver claim from Jacksonville

LG Laken Tomlinson, 2017, trade from Detroit

QB Jimmy Garoppolo, 2017, trade from New England



RT Mike McGlinchey, 2018, first round

WR Dante Pettis, 2018, second round

LB Fred Warner, 2018, third round

DB Tarvarius Moore, 2018, third round

DB D.J. Reed, 2018, fifth round

S Marcell Harris, 2018, sixth round

WR Richie James, 2018, seventh round

RB Jeff Wilson, 2018, rookie free agent

TE Ross Dwelley, 2018, rookie free agent

CB Emmanuel Moseley, 2018, rookie free agent

CB Richard Sherman, 2018, veteran free agent

RG Mike Person, 2018, veteran free agent



DE Nick Bosa, 2019, first round

WR Deebo Samuel, 2019, second round

P Mitch Wishnowsky, 2019, fourth round

LB Dre Greenlaw, 2019, fifth round

OT Justin Skule, 2019, sixth round

LB Azeez Al-Shaair, 2019, rookie free agent

DL Kevin Givens, 2019, rookie free agent

LB Kwon Alexander, 2019, veteran free agent

RB Tevin Coleman, 2019, veteran free agent

OL Ben Garland, 2019, veteran free agent

OL Daniel Brunskill, 2019, veteran free agent

TE Levine Toilolo, 2019, veteran free agent

CB Dontae Johnson, 2019, veteran free agent

WR Jordan Matthews, 2019, veteran free agent

DL Anthony Zettel, 2019, veteran free agent

DT Earl Mitchell, 2019, veteran free agent

TE Daniel Helm, 2019, waiver claim from L.A. Chargers

DE Dee Ford, 2019, trade from Kansas City

WR Emmanuel Sanders, 2019, trade from Denver

INJURED RESERVE

TE Garrett Celek, 2012, rookie free agent

DE Ronald Blair, 2016, fifth-round draft pick

WR Trent Taylor, 2017, fifth-round draft pick

NT D.J. Jones, 2017, sixth-round draft pick

WR Marquise Goodwin, 2017, veteran free agent

DL Kentavius Street, 2018, fourth-round draft pick

DL Jullian Taylor, 2018, seventh-round draft pick

RB Jerick McKinnon, 2018, veteran free agent

C Weston Richburg, 2018, veteran free agent

T Shon Coleman, 2018, trade from Cleveland

WR Jalen Hurd, 2019, third-round draft pick

CB Tim Harris, 2019, sixth-round draft pick

WR Shawn Poindexter, 2019, rookie free agent

OL Andrew Lauderdale, 2019, veteran fee agent

DL Damontre Moore, 2019, veteran free agent

CB Jason Verrett, 2019, veteran free agent