Three consecutive seasons of wretched basketball finally helped the 76ers — in a major way.

Over the past three seasons of losing — a combined 47-199 — the 76ers entered the 2016 NBA draft lottery with a 26.9 percent chance of winning the No. 1 overall pick.

But there was no guarantee.

The last two years were a harsh lesson when the pingpong balls bounced at No. 3 in back-to-back seasons for Joel Embiid and Jahlil Okafor. The injury-prone Embiid has yet to play one second in the league while Okafor showed plenty of ability but a lack of maturity off the court.

At some point, the Sixers had to be destined for the top pick, right? Well, it finally worked out.

Since the Los Angeles Lakers’ pick came in at No. 2, it stays there. If it had landed outside the top three, it would have gone to the Sixers. That pick is top three protected in ’17 but unprotected in ’18. So there’s another bright light looming in the future.

For now, the Sixers are likely to select either LSU’s Ben Simmons or Duke’s Brandon Ingram. Either player would be a gargantuan upgrade for a roster which is desperate for more young talent.

The Sixers also own the No. 24 and 26 picks in the draft giving them additional pieces.

Getting that No. 1 overall spot is the key.

Remember Allen Iverson in 1996? The Answer didn’t lead the Sixers to a championship but came pretty darn close in ’01 against Shaquille O’Neal, Kobe Bryant and the Lakers. Had Iverson been surrounded with a bit more talent, a title just may have been won. Iverson is headed for the Hall of Fame, so it’s impossible to argue with that pick.

Projecting Simmons or Ingram 12 to 15 years from now is difficult. Both players look mighty impressive and their chances of seeing dividends from a top pick are increased.

Sure, there are a litany of players taken deep in the first round — and even in the second round — who have turned out to be All-Stars.

If there’s a choice between No. 14 or No. 1 in the lottery, you want the top choice. Every time. It’s a no-brainer.

Going through a 10-win season was brutal in every way imaginable. The losses took their toll on the players and really the whole organization. This was following 19-win and 18-win seasons. Coach Brett Brown, who was the Sixers’ representative at the lottery, deserves a roster with upgraded talent.

This is a start.

The draft, coupled with the potential return of Embiid as well as Dario Saric, will help improve the talent. Maybe a free agent or two sees what the Sixers are doing under new management — Bryan Colangelo — and wants to be part of a special rebuild.

No more 1-30 stretches. No more running D-League players in and out nonstop. No more 60- and 70-plus loss seasons. Colangelo said from the beginning that he’s determined to turn their fortune around.

That fortune was helped by a pingpong ball finally bouncing their way. It was a matter of time.

The goal now is to do their homework and make the right pick. They can’t make a mistake here.

Looking at the draft board, this looks to be a winner. Since advancing to the Eastern Conference semifinals and falling to the Boston Celtics in seven games, the Sixers have done nothing but lose.

There are so many hurdles ahead, but winning the draft lottery is a heck of a strong way to open their offseason.

Let the fun begin between now and the draft.