He hounded network executives at all hours, demanding Nielsen reports and asking: “How’d we do? How’d we do?”

He routinely fibbed about ratings, declaring “The Apprentice” the No. 1 show on television even when, as NBC officials would sheepishly admit, it was not.

And he demanded a raise to $6 million from roughly $50,000 an episode during a lunch with Jeff Zucker, then head of NBC. It was only fair, he explained, because the cast of NBC’s sitcom “Friends” earned the same amount — combined.

With its glamour and famous catchphrase — “You’re fired” — “The Apprentice,” which debuted in 2004, was the ultimate showcase for Donald J. Trump’s self-styled image as a power-wielding mogul. But it also served as a prequel of sorts for his improbable next act as a presidential nominee, who next week will return to prime time as the ringmaster of the Republican National Convention.

More than Mr. Trump’s real estate deals, the show transformed its star from a New York curiosity into a national sensation, introducing millions of viewers — and, later, voters — to a highly flattering, highly fictionalized version of Mr. Trump, more appealing than the real-life developer whose successes were tempered by bankruptcies and personal turmoil.

Mr. Trump, who had little previous television experience, revealed a showman’s mastery of the medium, which he used this year to confound political opponents and seduce ratings-hungry networks. Those skills will be on full display at the convention in Cleveland, where Mr. Trump is personally wooing celebrities and overseeing stagecraft for a blowout spectacle that will be less C-Span, more MTV.

If “The Apprentice” was a vehicle for Mr. Trump to hone his craft as an entertainer, it also previewed darker aspects of his presidential campaign. Mr. Trump, producers say, casually indulged in ethnic stereotypes, once asking a network executive if a Jewish agent would earn him more money. Another time he pitched an “Apprentice” season pitting black contestants against white contestants, an incendiary proposal that NBC never pursued.

Even his less provocative behavior in the show’s famous boardroom signaled troublesome traits that would later emerge on the campaign trail — a penchant for dividing teams against each other, blunt insults and occasional bullying.

Image

Mark Burnett, left, the creator of “The Apprentice,” with Donald Trump, its star, in 2003.CreditChester Higgins Jr./The New York Times

In an interview in his Trump Tower office, Mr. Trump said that the difference between his reality show and his presidential bid was, simply, one of magnitude.

“When I did ‘The Apprentice,’ I didn’t think there would be anything bigger,” Mr. Trump said. “This is times 200. Maybe a thousand.”

“I wasn’t doing the firing,” Mr. Trump added, alluding to his vanquishing of his Republican rivals. “But in a certain way, I was. If you think about it.”

Mr. Trump was never supposed to be the sole star of “The Apprentice.”

The show’s creators, led by the reality show producer Mark Burnett, had planned a rotating cast of tycoon hosts — first Mr. Trump, then maybe Mark Cuban, Richard Branson or even Steven Spielberg.

Mr. Zucker, who is now the president of CNN, was so enamored of the concept that he shut his office door and told Mr. Burnett he could not leave until a contract was signed. But executives had a lingering concern: Would viewers be put off by the show’s harsh climax, in which a churlish Manhattan titan dismisses a wide-eyed aspirant?

Producers went so far as to test out sympathetic lines for Mr. Trump to use in the boardroom, including, “We need to let you go,” and “Unfortunately, your time here is over.”

But Mr. Trump seemed to grasp instantly what the camera wanted. He ad-libbed the “You’re fired” line in the very first episode, along with its accompanying, air-slicing hand jab — which came to be known among producers as “the Cobra.”

The line was a sensation on set, from the executives in the control room to the union men working the cameras. “What other person in America could make getting fired a popular thing?” said Jim Dowd, NBC’s former publicity chief.

Donald Trump "You're Fired"CreditVideo by Holly Hillis

The host was proving to be popular, too. Shortly after the show began, fully one-half of Americans told Gallup that they held a favorable view of Mr. Trump, his best rating ever, up from just one-third a few years earlier.

Mr. Trump soon became obsessed with Nielsen ratings, a precursor of his now constant references to political polls. Mr. Trump even had his agent obtain the ratings early, so he could break the news to executives himself.

“It went from this apprehension and nervousness to, ‘Yeah, I knew this was going to be a hit,’” said Mr. Dowd, whom Mr. Trump later asked to serve as press secretary for a possible 2008 presidential bid.

Mr. Trump eschewed cue cards on set, improvising most of his lines. Usually, he needed only a single take, although there were exceptions. Once, a windy helicopter landing mussed his famous hair, forcing him back to his limo for restyling.

Presaging the primary night parties he would later hold at Trump Tower, Mr. Trump insisted that the “Apprentice” set be built inside his Fifth Avenue skyscraper. Tara Dowdell, a contestant who has criticized Mr. Trump, remembers him giving behind-the-scenes tours to potential business partners.

Asked about the set, Mr. Trump said in the interview: “I am the world’s most efficient human being. I go downstairs in the elevator, go into the boardroom, scream and rant and rave, come upstairs, and I’m finished.”

Donald Trump business success tips from the ApprenticeCreditVideo by Double Your Success

He impressed NBC by traveling to casting calls, once suggesting that the contestants debate a newly passed immigration enforcement law in Arizona. He pitched himself as the host of the Emmy Awards, only to be informed that the show was carried by a rival network.

“Donald’s craft was talking to the press,” said Jeff Gaspin, a former top NBC executive. “He was a promoter. He knew what he had to do, and he did it.”

“The Apprentice” also enriched Mr. Trump, although there is disagreement over how much. Last year, Mr. Trump said he earned $213 million over his 11 years on the show, including his ownership stake in the series.

Still, some executives estimated that Mr. Trump may have collected roughly $100 million, including appearance fees, an ownership stake and lucrative sponsorship deals with companies like Chrysler.

Image

A plaque bearing Donald Trump’s signature line from “The Apprentice” hanging on a wall in Trump Tower.CreditSam Hodgson for The New York Times

But even as profits rolled in, some executives and contestants were unsettled by what they described as Mr. Trump’s casually offensive comments, years before he would deploy racially charged statements on the campaign trail.

During salary talks, one Jewish executive, who spoke on the condition of anonymity, remembered Mr. Trump asking, “Don’t you think I should get a Jewish agent, so he can negotiate better for me?” A spokeswoman for Mr. Trump had no comment when asked about the exchange.

A scene from a 2005 episode of “The Apprentice.”CreditReed Hoffman/NBC Universal

For a TV Guide cover, Mr. Trump posed alongside two female contestants in scanty outfits; the headline read: “Why the Girls Are on Top.”

Randal Pinkett, an African-American contestant who won the show’s fourth season, said that Mr. Trump was never overtly racist. But he was taken aback during the finale when Mr. Trump suggested that he share his prize with the rival he had just defeated, a white woman.

“I firmly believe it had racial overtones,” said Mr. Pinkett, who recently denounced Mr. Trump’s candidacy. “I was the only person of color to win ‘The Apprentice.’ Donald never asked that question of any other winner.” He added, “I do think this mirrors the way that some privileged white men think.”

Other contestants said that Mr. Trump did not act inappropriately. “My experience with him on ‘The Apprentice’ was completely different than the man I see speaking about hateful things,” said Kevin Allen, an African-American entrepreneur who appeared in the second season.

Mr. Trump, whose “Apprentice” boardroom chair still decorates his office, remains deeply invested in the show: He is asking friends, executives and even campaign crowds about his successor as host, Arnold Schwarzenegger. “How do you think Arnold’s going to do?” Mr. Trump said, several times, over the course of a 45-minute interview.

His presidential run has also raised the show’s international visibility. Mr. Burnett, in an interview, said he had heard from potential hosts for foreign versions of the show, who believed it could propel them to higher office in their own countries. “They’re thinking, ‘If I do this show for four years, that’s a great launchpad into politics,’” he said.

Image

Tara Dowdell, a former contestant on “The Apprentice” who now runs her own marketing company and opposes Donald Trump’s candidacy.CreditKarsten Moran for The New York Times

Privately, some in TV who helped build Mr. Trump’s franchise now say they are alarmed at the prospect of his winning the White House. Others have been confronted by friends and family members, who wonder if they abetted Mr. Trump’s rise.

“My son has said it to me, ‘This is your fault, Dad,’” said Mr. Gaspin, the former NBC executive, with a laugh.

Asked about his salary negotiation with Mr. Zucker, Mr. Trump said that he was inspired by a New York Post article about the actors’ salaries on “Friends,” then in its last season.