The tug of war over who will get the next title shot against heavyweight beltholder Oleg Maskaev is over.

Mandatory challenger Samuel Peter will get the shot. Unretiring former titlist Vitali Klitschko, who tried to cut the line, will instead wait for the Maskaev-Peter winner.

After three months of convoluted negotiating, deals coming together and then unraveling, the sides agreed Wednesday that Maskaev (34-5, 26 KOs) will face Peter (28-1, 22 KOs) by August. Klitschko (35-2, 34 KOs) will be the mandatory challenger for the winner.

"All the parties involved have acknowledged this agreement," Dino Duva, Peter's promoter, told ESPN.com. "Klitschko has agreed to stop pursuing the fight with Maskaev. The WBC orders Maskaev to fight Peter and the winner to fight Vitali before the end of the year. It's all spelled out so there is no ambiguity.

"I will begin negotiations with [Maskaev promoter] Dennis [Rappaport] immediately. We were told by all the lawyers it is a done deal."

Duva and Rappaport will have about three weeks to strike a deal or the WBC will call for a purse bid, opening the rights to the fight to the highest bidder.

"My goal is now to schedule the [Maskaev-Peter] fight as soon possible and to do it as amicably as possible," Duva said. "If we don't make a deal, we go to a purse bid. But I want to make a deal with Dennis."

Rappaport would have preferred to make the Klitschko fight, but said he and his fighter will abide by the agreement.

"Absolutely we will," he said. "We'll see if we can negotiate a deal. If we can't it will go to a purse offer."

Peter defeated James Toney in back-to-back title elimination bouts in September and January. After the second win -- a lopsided decision victory -- the WBC was supposed to officially appoint him as Maskaev's mandatory challenger.

However, a couple of weeks after the fight Klitschko announced he was coming out of retirement and wanted to fight Maskaev.

Klitschko had retired as WBC champion in November 2005 because of knee injury. In acknowledging his retirement, however, the WBC said that if he returned he would be allowed to immediately fight for the title. Maskaev wanted to make that fight because it would be worth far more money to him than a Peter bout, and the sides began negotiating over the objection of the Peter camp.

Duva was ready to sue the WBC and public opinion leaned heavily in favor of Peter -- who had already won consecutive eliminators and paid hundreds of thousands of dollars to the WBC to sanction them -- getting a title shot before Klitschko, who hadn't fought in more than two years.

Eventually, the Peter camp agreed to step aside to allow Maskaev-Klitschko to take place June 2 on HBO in Moscow with Peter getting a guaranteed shot at the winner.

Peter would receive $2.75 million as part of the step-aside package -- a $1.5 million non-refundable payment up front and $1.25 million following Maskaev-Klitschko. It took weeks for the sides to iron out every detail, including a stringent timetable for when the Peter bout had to happen and what would happen in the event of a draw. There was also an extended search for an insurance policy to cover the $1.5 million advance payment to Peter in case Maskaev or Klitschko was injured and the bout had to be canceled.

Meanwhile, Rappaport and Klitschko adviser Shelly Finkel were busy working to secure financing for the fight and the step-aside payment. Three times they made separate deals in Russia, they told ESPN.com.

With each successive deal, the money from investors lessened, Rappaport said.

"Initially, the dollars for a Maskaev-Klitschko fight were huge," he said. "Then the revenue diminished because of the changing deals, and in large part because of what we had to pay Peter, which I thought was too much. It's been so bizarre, this whole experience, it is almost impossible to explain."

Rappaport said they originally had a rich deal in Russia that would have covered everything. However, the investors got nervous, Rappaport said, when another promotional company announced that WBO heavyweight titlist Shannon Briggs would defend his belt against Russia's Sultan Ibragimov in Moscow, also on June 2.

"The day they were supposed to sign, it came out that Briggs and Ibragimov were fighting on the same day in Moscow and they got cold feet," Rappaport said.

Then they made arrangements with a second investor, who wired a $2 million deposit. Finkel and Rappaport said the wire transfer turned out to be phony, so that deal went down the drain.

Finally, Rappaport cut a third deal for even less money with the investors who backed Maskaev's December title defense in Moscow against Peter Okhello.

"The contract was set, the site deal was completed and the insurance policy to cover the $1.5 million was in order," Rappaport said. "Then, all of a sudden, Klitschko doesn't sign the contract. I get a call [Wednesday] morning from Shelly saying Klitschko doesn't think he will be ready June 2, that he needs another few weeks. I said, 'This is insane. All of a sudden, Klitschko doesn't know when the fight is supposed to take place? We've been going over this for eight weeks.' This has been the most frustrating experience."

Finkel said Klitschko's desire for additional time had nothing to do with his knee. Rather, trainer Fritz Sdunek is hospitalized and needs additional recovery time before he can be available for training camp.

"Vitali spoke to Fritz and saw him in the hospital," Finkel said. "Fritz told him, 'We can do it.' But things were unraveling with the deal. Timing is everything. This took too long to happen and it became too much of an ordeal. Vitali said, 'Let Maskaev fight Peter, we'll fight the winner.'"

Finkel said Klitschko planned to take an interim fight this summer in Germany, which would be his first since making his only title defense against Danny Williams on Dec. 11, 2004.

Duva said that Peter just wanted the title shot and didn't care about the step-aside money.

"Sam is ecstatic," Duva said. "This is all he ever wanted -- to fight for the title. The step-aside money was fine, but we really wanted to fight for the title. It's frustrating the way things have happened, but the only thing we are thinking about now is getting Sam the title fight."

Finkel sounded worn out from weeks of trying to put the Maskaev-Klitschko deal together. Finally, he said, it just wasn't worth it.

"In the end, the whole deal became more onerous -- trying to keep HBO, the WBC and Peter in the deal," Finkel said. "It took a tremendous toll on everyone going through it. In a certain way, it's almost a relief that [Maskaev-Klitschko] it's not happening. After a certain amount of time, it's just not meant to be."