Leonard Nimoy as Mr. Spock in a 1966 “Star Trek” episode. (CBS via Getty Images)

The president’s statement was punctuated by this unambiguous declaration: “I loved Spock.”

When Leonard Nimoy, the actor who played the iconic “Star Trek” character, died two weeks ago, the White House stopped to take official notice. “Cool, logical, big-eared and level-headed, the center of Star Trek’s optimistic, inclusive vision of humanity’s future,” President Obama said, praising Nimoy’s portrayal of Spock and, maybe not so elliptically, describing himself.

Leonard Nimoy, the actor known and loved by generations of “Star Trek” fans as half-Vulcan, half-human Mr. Spock has died at 83, his family said Friday. (  / AP)

Historically, presidential condolence statements may be one of the most idiosyncratic of White House processes. There are no formal rules; decisions are made spontaneously, and no matter who writes them, or when, they end up largely reflecting the personality and inclinations of the sitting president.

Two days after declaring his love for Spock, the president, a big Chicago White Sox fan, paid homage to Minnie Minoso, the Afro-Cuban baseball player who rose through the ranks of the Negro League before becoming “Mr. White Sox.”

“In some ways the president is speaking for himself with these statements, but he’s also saying something for the country,” said Jon Favreau, who as head of speechwriting during Obama’s first term was tasked with helping oversee the process.

Minnie Minoso and his wife, Sharon, leave the West Wing after meeting with Obama on Aug. 5, 2013. (Pablo Martinez Monsivais/Associated Press)

“For Obama, the elevation of cultural leaders has been important,” Favreau added, people who ordinary Americans feel a connection to and who have helped shape the nation’s social fabric.

The Rev. Willie T. Barrow, left, in 1986 with Jesse Jackson Jr., center, and Chicago Mayor Harold Washington. (Associated Press)

On Tuesday, the White House noted the death of the Rev. Willie T. Barrow. The announcement described Barrow as “a Civil Rights icon and a Chicago institution, a ‘Little Warrior’ in pursuit of justice for all God’s children.”

It was not always this way. Hoover Institution research fellow Peter Robinson, who served as one of Ronald Reagan’s speechwriters, said his recollection was that “the Reagan administration tended to restrict condolences to people who had served in office, with the exception, of course, of Hollywood figures whom the Reagans themselves had known.”

Over a quarter of Obama’s statements have recognized African Americans, more than twice the figure for President George W. Bush’s. And the current president has issued more statements than his predecessors on Latinos, Asian Americans and Native Americans, as well as social activists and civil rights leaders. The list includes Wilma Mankiller, Percy Sutton and Ann Nixon Cooper, whom he lauded in his 2008 election night victory speech and died a year later at age 107.

READ: Explaining who gets a White House statement, in charts

Bush, for his part, weighed in more frequently on the deaths of religious leaders, Republicans, Arab dignitaries and animals (since the Bushes’ cat India and dog Spot died while he was serving). The honorees encompassed an Iraqi Christian leader, Archbishop Paulos Faraj Rahho; Afghanistan’s last king, Mohammad Zahir Shah; and the Rev. Jerry Falwell.

Alabama Gov. George Wallace, left at the microphone, stands with President Lyndon Johnson, right, in Washington in 1965. (Associated Press)

The statements are largely written by White House aides, but the chief executive will often weigh in if it’s a sufficiently high-profile figure. On Sept. 14, 1998, according to documents from the Clinton Library, President Bill Clinton tinkered with his speechwriter Jeff Shesol’s draft of a statement honoring former Alabama Democratic governor George Wallace, who evolved from a hardline segregationist to a more conciliatory figure.

At the end, referring to the late governor’s decision to embrace the politics of social inclusion, Clinton scribbled in his round cursive writing, “For that all Americans can be grateful.”

Current and former senior administration officials say it is a process that involves some of Obama’s top aides, including his chief of staff, senior adviser Valerie Jarrett and a group of senior communications staffers.

Under past presidents, by contrast, most statements were handled by the Office of Presidential Correspondence, with the speechwriting staff weighing in on only the most important deaths.

Favreau said that under Obama, the White House has tended to make more, rather than fewer, statements about someone’s passing, since there is little cost to doling out extra honors: “It’s not like the president has so many condolence statements to make.”

And the statements, which Obama almost always personally signs off on, often include personal references. In a joint statement the Obamas issued in 2014 about the death of the actress and civil rights activist Ruby Dee, they noted that they had seen her in Spike Lee’s “Do the Right Thing” on their first date.

Sometimes, either the wording of a statement — or the fact that one isn’t issued — stirs controversy. Washington Times columnist Joseph Curl complained that “half-white Barack Obama” honored African American pop superstars Michael Jackson and Whitney Houston, but did not issue a statement on the death of the Beastie Boys’ Adam Yauch.

And they can prompt internal debate at the White House. In his book, “How Ronald Reagan Changed My Life,” Robinson, of the Hoover Foundation, recounts how he and speechwriter Josh Gilder fought back in 1985 when the staff secretary at the time, Peter Chew, struck a line describing the late ambassador John Davis Lodge as a “fighter against Communism.” Gilder challenged Chew, who agreed to restore the conservative mantra.

Kurt Cobain of Nirvana during the taping of “MTV Unplugged" in 1993. (Frank Micelotta/Getty Images)

A decade later, Clinton and his aides were discussing whether to issue a statement on the death of grunge icon Kurt Cobain, who had committed suicide. A staffer came into the Oval Office to explain why Cobain was so important to young people; to make the point to the Baby Boomer president, the aide compared Cobain to a member of the Beatles.

The White House eventually decided against a statement, but the discussion left enough of an impression on Clinton that when the members of Pearl Jam visited him in the Oval Office the next day, the president asked Eddie Vedder if he should give a national address on Cobain’s death. (Vedder advised against it, suggesting that such high-level attention could spur copycat suicides.)

In most instances, White House condolence statements represent a scramble. There are no polished, pre-written statements on the sick or the elderly.

When Richard Nixon died in April 1994, his family gave Clinton’s staff a couple of hours advance notice that they were going to announce his passing. Donald A. Baer, who had just come on as chief speechwriter, remembered “there was nobody around,” and he was tasked with the job of helping Clinton eulogize one of the nation’s most polarizing political figures.

“I had never written anything like that before, and I had only been there for a month,” Baer said in an interview, adding that he did a little research and consulted with a couple of former Nixon aides before drafting a short statement that Clinton read in the Rose Garden that evening.

Despite the rush, Clinton was pleased enough with the outcome that he didn’t understand why Baer would need to write a different eulogy for him to deliver at Nixon’s funeral in California some days later. “But I really liked that thing I read the other night,” the president told him.

Still, the experience was searing enough that later, Michael Waldman, who succeeded Baer as Clinton’s head speechwriter, instructed Shesol to prepare a eulogy about Reagan when he fell ill during Clinton’s second term.

“But there was always another speech to be written that was urgent business. I never quite finished it,” Shesol said, adding that he kept “an ominous Reagan binder on my shelf for a better part of three years,” which was unlabeled in order to avoid spooking people.

Similarly, when ­then-Israeli Prime Minister Ariel Sharon suffered a massive stroke in January 2006, aides for George W. Bush began preparing an official statement.

“He was such a global figure. There was language prepared and preparation for a more expanded statement,” recalled ­Anita McBride, who served as Laura Bush’s chief of staff and is now an executive–in-residence at American University. “In the White House, you are always prepared, but you always have to react on a moment’s notice.”

Sharon didn’t die until 2014, long after Bush had left office; Reagan died in 2004, after Clinton’s tenure and during Bush’s.

On some occasions, senior administration officials leave their own mark on White House condolence statements. Jarrett, Favreau recalled, “brought it to everyone’s attention” in 2011 that the rapper Heavy D had died and suggested that Obama honor him “because he was a very important figure in music and in the African American community.”

The Rev. Al Sharpton read Obama’s letter of condolence at the New York rapper’s funeral, in which the president lauded his “infectious optimism and many contributions to American music.” The crowd roared its approval.

And Shesol, a former cartoonist, managed to persuade his superiors to issue a presidential statement on both the retirement of “Peanuts” creator Charles M. Schulz in December 1999, as well as his death just two months later.

The characters Schultz created, Clinton said on Feb. 13, 2000, did not just add amusement to Americans’ daily lives. “The hopeful and hapless Charlie Brown, the joyful Snoopy, the soulful Linus — even the ‘crabby’ Lucy — give voice, day after day, to what makes us human.”

In the end, these presidential statements tell us not only about the life of a person who has just departed but about the country they leave behind.

“It’s a tiny little tone poem. It’s a very little, constrained piece of writing,” Shesol said, adding that one needs to capture the sadness of the moment “without being maudlin about it. You want to give them their due. This might well be the last thing the president ever says about them.”

Philip Bump contributed to this report.