Among the surprisingly few rappers who have served as Minnesota State Fair grandstand headliners over the years, Thursday’s selection, Logic, squarely fit the mold of most of them: safe, positive and, well, a little square.

The Maryland hip-hop star born Robert Bryson Hall II followed in the designer-sneaker footsteps of the grandstand’s last two rap headliners, Macklemore in 2013 and G-Eazy in 2016; yep, it’s been that long between shows. Like them, he came up through the locally adored indie-rap circuit before crossing into Top 40 pop territory, which he did in 2017 with the bittersweet suicide-prevention song “1-800-273-8255.”

After reiterating his indie roots as headliner of last year’s Soundset festival — coincidentally held in the fair’s Midway area — Logic played to a more Top 40-centric crowd Thursday.

For fairgoers wanting more hip-hop than what’s inside the rabbit pens, he proved a good fit.

More surprisingly, Minneapolis mad man Prof was picked to open the show, which seemed to amuse him as much as it did the fans there who knew him. “I think it’s cool they invited me out on Senior Day — and I don’t mean high school seniors,” the Rhymesayers-branded rapper quipped, and then assured everyone he wouldn’t drop any F-bombs. For proof, of course, he dropped some F-bombs, which were playfully covered over with bleeps.

In keeping with Logic’s more dramatic tunes, Prof showed a more serious side with his stark and personal dirge “Criminal” and the slow-burning gem “Gasoline.” But mostly he (and the crowd) had crazy fun, culminating with dozens of beach balls bouncing overhead during “Church.”

Logic was all business at first. Donning glasses and a low-riding ball cap, the 29-year-old rapper tore through the rapid-tongued opening tunes “44 More” and “Everybody” with impressive laser focus. He kept up the breathless pace through his latest hit “Homicide,” in which he had to pipe in Eminem’s guest vocals but still rose up to his hero’s level of high-wire wordplay.

Logic’s first between-song banter was rather serious, too.

“I represent one thing: peace, love and positivity,” he earnestly pledged (actually three things, but the one-love point was taken).

That harmonious tone continued even as the 75-minute set turned looser and occasionally sputtered to a lull. One of those times came when his longtime crony Bryson Tiller came out and delivered two songs (one too many).

As he breezily bounced through some of his older songs — including “Under Pressure” and the ultra-hooky “Fade Away” — Logic frequently stopped and interacted with the 6,362 attendees, adding to the positive vibe with his loving comments.

He singled out fans wearing old tour T-shirts or holding up signs. He directly addressed one fan streaming video off her phone (and thus addressed all her followers, too). He especially thanked one fan who brought him a baby onesie (after word got out last week he’s an expectant father).

It was all so fun and informal that by the time “1-800-273-8255” came along near the end, its somber tone might have seemed out of place.

But the crowd turned it into another ultra-pleasant highlight as a sea of phone flashlights appeared and everyone sang about loving life. So much for rap being out of step with the Great Minnesota Get-Together.