When the Republicans announced a few months ago that they were going to eschew the "mainstream" media in favor of having their presidential primary debates moderated by people from conservative news outlets, some mocked them for wanting to stay within the right's cozy information bubble. At the time, I thought it was a good idea, not only because those mainstream media figures have done such a miserable job at primary debates in the past, but because conservatives are actually more likely to ask Republican candidates the right questions in a primary debate. They understand what primary voters care about, they appreciate the rifts within the party, and they might actually have an incentive to ask tougher questions.

And that's exactly what we got Thursday night. Judging by what I saw on Twitter while the debate was going on, the aggressive questioning from the Fox News anchors came as a surprise to many. But if you understand what Fox is really about, it shouldn't have been.

Fox isn't just a place where Republican politicians can find a warm welcome and conservative viewers can have their pre-existing ideas reinforced, though most of the time it is. The network is also an important political actor that exists in part to serve the interests of the Republican Party. Since it was created in 1996, its chief Roger Ailes, a former GOP operative, has masterfully balanced that goal with its other purpose, making gobs of money. And there are times — like Thursday's debate — where serving the interests of the Republican Party means getting extremely tough on certain Republicans.

It started right from the outset. The first question asked the candidates to raise their hands if they were unwilling to promise to support the party's eventual nominee no matter who it might be. There was only one candidate whose response was in question, and indeed, Donald Trump was the one who raised his hand. This is vital information for primary voters, many of whom might be turned off by Trump's lack of loyalty to the party (even if Trump's supporters, who tend to scorn the "establishment," surely cheered).

The next question went to Ben Carson, one that criticized his limited understanding of foreign affairs and suggested he isn't prepared to be commander in chief. Then there was one to Marco Rubio essentially asking him to pick a fight with Jeb Bush, then one to Bush about whether the country wants another Bush in the White House, then one to Trump relaying some awful things he has said about women, then one to Ted Cruz asking about his "toxic relationship with GOP leaders in Congress," then one to Chris Christie battering him for his poor fiscal and economic record in New Jersey, and on and on. Not only was nearly every question confrontational, most of them were aimed at what people within the party see as each candidate's most glaring weakness.

Some of these questions were about matters that could trip a particular candidate up in a general election, while others, like questions about John Kasich's support of Medicaid expansion or Rand Paul's troubling lack of belligerence on foreign policy, concerned things that primary voters don't like about them. In fact, the only candidate who could have walked away thinking he didn't get pummeled by the Fox hosts was Marco Rubio, whose questions were friendly compared to those the rest of the candidates got.

So what was going on? At this stage of the primary campaign, the Republican Party's interest lies in weeding out the weak candidates and testing the strong ones to see who can stand up to tough questions (and it also lies in cutting Donald Trump down). If you're a Republican — whether you're an ordinary voter or a powerful party figure — it's important for you to know how Jeb Bush answers questions about his brother's wars and how Scott Walker defends his state's poor record of job growth, because those are questions that will certainly come up if either one is the nominee.

If you think of Fox not just as a booster of the GOP but as a party actor, it would have been shocking for them to do otherwise. Right now what the party needs is to put these candidates through the ringer and see who comes out looking like he can withstand the rigors of the general election. A presidential campaign is often compared to a marathon, but it's more like running a marathon while people are pelting you with rocks all along the route. The last thing the party wants is a candidate who can't survive that gauntlet.

So for the next eight or nine months until Republicans have their nominee, Fox is going to be tough on its candidates, like a drill sergeant getting them in shape for the battles to come. Once that nominee is chosen, the network's tone will shift on a dime, and he'll suddenly become the greatest American since Ronald Reagan (who, by the way, was reverently invoked in the debate by only five of the 10 candidates, a shocking oversight that I'm sure will be corrected the next time they assemble).

In the meantime, Fox is the place to go if you want to see these candidates tested. You certainly wouldn't want it moderating a general election debate, but during the primaries, it can serve a vital function. Sometimes, being Fox means telling Republican viewers what they want to hear, but other times it means telling them what they need to hear. It may seem strange given all the ways Fox is a problematic force in contemporary American politics, but right now they're performing a valuable service for the entire electorate.