CHICAGO (AP) — The Orlando Magic won the NBA draft lottery Tuesday night and landed the No. 1 overall pick for the first time since they got Dwight Howard in 2004.

It’s the fourth time lottery luck struck for the Magic, who won in back-to-back years in 1992 and 1993, taking Shaquille O’Neal and then trading the rights to Chris Webber for Penny Hardaway.

Orlando finished with the worst record in the Eastern Conference at 22-60 and missed the playoffs for the eighth time in 10 years. But the Magic got a huge win in the lottery, where they had a 14% chance landing the top pick.

“It feels great,” president of basketball operations Jeff Weltman said. “I’m so happy for our fans. They really stuck with us. And nights like this help, where you can really show the fruits of why you go through these phases and these cycles. And hopefully, they’re really excited by this.”

Duke’s Paolo Banchero, Gonzaga’s Chet Holmgren, Purdue’s Jaden Ivey and Auburn’s Jabari Smith are widely considered the most likely candidates to be taken first. The draft is June 23 in New York.

Oklahoma City got the second pick, followed by Houston and Sacramento. The Kings moved up from the No. 7 spot entering the lottery.

Detroit picks fifth, with Indiana, Portland, New Orleans, San Antonio and Washington rounding out the top 10. The rest of the lottery results are: New York, Oklahoma City, Charlotte and Cleveland.

The lottery, with 14 ping pong balls numbered 1 through 14 placed into a hopper, sets the first four picks. The remainder of the non-playoff teams go in reverse order of their finish.

Houston, Orlando and Detroit had the best odds of winning the lottery at 14%. All three had young teams that finished at the bottom of the NBA.

The Magic are committed to building through the draft after trading veterans Nikola Vucevic and Aaron Gordon in March 2021 for first-round draft picks in 2023 and 2025. But they were missing two of the young players they are trying to build around last season with Jonathan Issac and Markelle Fultz recovering from knee injuries.

New Orleans might be one of the biggest winners as the lone playoff team with a lottery pick. The Pelicans got it in the 2019 trade that sent Anthony Davis to the Lakers.

With Los Angeles struggling to a 33-49 record, eighth worst in the NBA, that put the Pelicans in position to cash in. They needed the pick to fall in the top-10 in order to keep it, and there was a 99.6% chance of that.

Now, they’re in position to add a lottery pick to go with All-Star Brandon Ingram.

Banchero, Holmgren and Smith decided to turn pro after one college season while Ivey spent two years at Purdue.

The 6-foot-10, 250-pound Banchero was viewed as a likely one-and-done player before he arrived at Duke from Seattle as part of a talented recruited class. He lived up to it, helping the Blue Devils reach now-retired coach Mike Krzyzewski’s record 13th Final Four before losing to archrival North Carolina.

With his strength and perimeter skills, Banchero averaged 17.2 points and 7.8 rebounds. He scored 20 or more 15 times while failing to reach double figures only twice in 39 games.

Holmgren, a 7-footer with the ability to pass and handle the ball like a guard, was one of the most highly touted recruits ever for Gonzaga. He was the West Coast Conference newcomer of the year, defensive player of the year and a first-team all-conference selection. He averaged 14.1 points, 9.9 rebounds and 3.6 blocks per game, and was a third-team AP All-American.

Smith also lived up to his billing as one of the top recruits ever for Auburn. The Tigers earned their first No. 1 ranking and spent three weeks in the top spot. The 6-10, 220-pounder from Fayetteville, Georgia, was a second-team, All-American and the SEC freshman of the year. He led Auburn in scoring, averaging 16.9 points and 7.4 rebounds. Smith was also the Tigers’ top 3-point shooter after making 79 of 188 attempts (43%).

The rest of the first round is slotted this way: Charlotte at No. 15, followed by Atlanta, Houston, Chicago, Minnesota, San Antonio, Toronto, Denver, Memphis, Houston (from Brooklyn through the James Harden trade), Milwaukee, San Antonio, Dallas, Miami, Golden State, Memphis and Oklahoma City.