It's all part of the plan. That is the contention of both the President Trump and Stormy Daniels camps in what looks as much like a publicity contest as a legal battle.

“We're setting the agenda,” Trump attorney Rudolph W. Giuliani insisted Sunday in an interview with The Washington Post, after yet another TV appearance.

“Everybody's reacting to us now,” he added, “and I feel good about that, because that's what I came in to do.”

Meanwhile, Daniels attorney Michael Avenatti tweeted Sunday that he and his client, who appeared on “Saturday Night Live” over the weekend, are the ones in control. Their omnipresence has induced “huge errors” by the president and his personal attorney Michael Cohen, Avenatti said.

The foundation of Giuliani's claim to be “setting the agenda” is that he volunteered on Sean Hannity's Fox News show last week that the president reimbursed Cohen for a $130,000, pre-election payment to silence Daniels, who claims to have had an affair with Trump more than a decade ago.

Jason Miller, a former Trump campaign communications director who also has worked for Giuliani, told The Post after Giuliani's disclosure that “they got this news out there on their terms, and they didn't wait around for enterprising journalists to break it. This is PR 101.”

The revelation has indeed driven multiple news cycles, but that is a consolation prize, at best. The existence of a payment to Daniels was supposed to never become public in the first place. Trump's team lost its handle on the story a long time ago and is left to celebrate having chosen the moment to admit the president's role.

Yet Daniels, too, has had to make the best of circumstances she did not dictate. The payment became public when the Wall Street Journal reported about it in January. Daniels told CBS News's “60 Minutes” in March that she was not behind the article and would have preferred that the arrangement remain secret.

“I was perfectly fine saying nothing at all, but I'm not okay with being made out to be a liar,” she told Anderson Cooper.

Avenatti's point about “constant media/PR pressure” rings true. Giuliani acknowledged as much when he told The Post last week that the president “was well aware that at some point, when I saw the opportunity, I was going to get this over with.” Trump and Giuliani clearly had determined that Daniels would not go away, that reporters would not stop asking questions, and that the president's reimbursement of Cohen would not remain hidden forever.

As I have written before, Daniels and Avenatti have mastered the art of staying in the news, and they deserve credit for making Trump feel that disclosure could not be avoided but was something that he would simply have to “get ... over with.”

But even Daniels and Avenatti could not have anticipated that Trump would bring in the freewheeling Giuliani, who, in turn, would cause so much chaos. The president himself said that Giuliani was still “learning the subject matter” and would eventually “get his facts straight.”

In Daniels vs. Trump, each side is trying to look like a master strategist, but neither is pulling all the strings.