ORCHARD PARK, N.Y. — The Buffalo Bills are pinning their future on Josh Allen, while maintaining their faith in the Wyoming quarterback even after a last-minute controversy erupted over a series of racially insensitive tweets he posted while still in high school.

Overseeing his first draft in Buffalo, general manager Brandon Beane moved up five spots in the order by making a trade with Tampa Bay to select Allen seventh overall on Thursday night. Tampa Bay acquired the Bills No. 12 pick and Buffalo's two second-round selections this year: 53rd and 56th.

Beane then made another move up in the first round by trading their No. 22 selection to Baltimore in order to fill a big need on defence by selecting Virginia Tech linebacker Tremaine Edmunds with the 16th selection. Buffalo also traded its third-round pick, 65th overall, while acquiring the Ravens' fifth-round pick (154th overall).

At 6-foot-5 and 237 pounds, Allen is a strong-armed but occasionally inaccurate passer after spending the past three years at Wyoming. He finished 365 of 649 for 5,066 yards passing with 44 touchdowns and 21 interceptions in 27 games with the Cowboys.

Allen's status a potential No. 1 pick was derailed less than 24 hours before the first round began after Yahoo Sports reported the quarterback sent the now-deleted tweets in 2012 and 2013. They contained racially insensitive language and offensive statements.

Allen apologized for the posts in an interview with ESPN early Thursday. He said he was parroting rap lyrics and catchphrases from TV and pop culture, adding he was "young and dumb" at the time.

ESPN reported the tweets were removed from Allen's account when it was vetted in January.

Wyoming coach Craig Bohl said Allen had "great relationships with his teammates and our fan base" and Allen "embraced diversity" while at Wyoming.

Bohl added in his statement: "We wish him all the best on his big night."

Edmunds, who turns 20 on Tuesday, is listed at 6-foot-5 and 250 pounds and was a two-year starter at Virginia Tech. He led the Hokies with 109 tackles and 5 1/2 sacks and named a Butkus Award finalist last season.

Edmunds will be given an opportunity to take over the middle linebacker spot after Buffalo lost starter Preston Brown in free agency last month.

Allen became the third quarterback selected in the draft, following Oklahoma's Baker Mayfield, who went first overall, and Southern California's Sam Darnold, who was picked No. 3 by the New York Jets.

The Bills had already moved up nine spots in the draft order last month by swapping first-round selections in a deal that also sent starting left tackle Cordy Glenn to Cincinnati.

Last week, Beane emphasized how "one of the main jobs of a GM is to find a franchise quarterback," while adding, "you have to have one."

Now the question becomes when Allen will be deemed ready to take over as starter on a team once again resetting on offence. He becomes the heir apparent to replace Tyrod Taylor. Buffalo's three-year starter was traded to Cleveland last month despite helping the Bills to a 9-7 record and end a 17-season playoff drought that stood as the longest active streak in North America's four major professional sports.

Taylor's departure left Buffalo with two mostly untested quarterbacks: Free-agent addition A.J. McCarron, who spent the past four seasons serving as Andy Dalton's backup in Cincinnati; and Nathan Peterman, best remembered for throwing five interceptions in the first half of a blowout loss to the Chargers in his rookie season.

Allen is from Firebaugh, California, and was not heavily recruited coming out of high school. He instead spent his freshman year playing at California's Reedley Community College, before going to Wyoming in 2015.

An NFL draft scouting report billed Allen as likely being "the biggest boom or bust quarterback prospect in the draft." Though he has prototypical size, he was knocked for his 56.2 career completion percentage at Wyoming.

Allen becomes just the fourth quarterback the Bills have selected in the first round. It's a group made up of Hall of Famer Jim Kelly (selected 14th in 1983), and a pair of players who failed to establish themselves as starters: EJ Manuel (16th, 2013) and J.P. Losman (22nd, 2004).

Buffalo has gone through a carousel of quarterbacks with 13 players having started at least five games since Kelly retired after the 1996 season. The lack of continuity has led to a pop-gun passing attack that ranked 31st in the NFL last year and hasn't cracked the top 10 since finishing fifth following Drew Bledsoe's first season with the team in 2002.

The Bills have also lacked stability at offensive co-ordinator. Brian Daboll, who oversaw national champion Alabama's offence last season, becomes Buffalo's sixth co-ordinator in seven years since being hired in January to replace Rick Dennison.

Beane spent his first 19 NFL seasons working up the ranks in Carolina before eventually serving as the Panthers assistant GM. He was hired by Buffalo in May in Doug Whaley, who was fired a day after last year's draft concluded.

Beane spent the past 11 months reshaping a roster by adding youth, modestly priced-free agents, stockpiling draft picks and freeing the team of numerous high-priced salaries, including trading defensive tackle Marcell Dareus to Jacksonville last season.

The Bills also acquired a seventh-round pick, 255th overall, in the trade with Tampa Bay. The deals leave them with six picks in the draft, including a third-rounder — 96th overall — on Friday.

___