Presented By NFLDraft2019

SANTA CLARA – The 49ers went into the NFL draft without a need at quarterback.

But shortly after all the picks had been made on Saturday, the 49ers agreed to a deal with undrafted rookie quarterback Wilton Speight, who finished his career with UCLA.

Speight agreed to a three-year contract with the 49ers, a league source told NBC Sports Bay Area. All undrafted rookies must sign three-year contracts.

Speight played seven games for first-year UCLA coach Chip Kelly. He completed 126 of 208 passes (60.6 percent) for 1,527 yards and six touchdowns.

Speight played his first three college seasons for Jim Harbaugh at Michigan. His best season came in 2016 when he completed 204 of 331 pass attempts for 2,538 yards and 18 touchdowns. He sustained an injury early in 2017 and appeared in only four games before transferring.

The 49ers typically carry four quarterbacks through training camp. C.J. Beathard and Nick Mullens will compete for the backup job behind starter Jimmy Garoppolo.

Follow the 49ers' undrafted free agent signings here:

-- Michigan/UCLA QB Wilton Speight

-- Arizona wide receiver Shawn Poindexter

-- Wyoming tight end Tyree Mayfield

-- West Georgia WR Malik Henry

-- Wake Forest cornerback Cam Glenn

-- Stephen F. Austin long snapper Chris Wilkerson

-- Penn State DT Kevin Givens

-- Florida Atlantic DL Hunter Snyder

-- Iowa OT Ross Reynolds

-- Midwestern State QB Layton Rabb

-- Rutgers LB Deonte Roberts