Shortly before the 2004 Illinois Democratic primary for the U.S. Senate, which he was to win by a landslide, Barack Obama was riding high. After about a year of nonstop campaigning, the Illinois state senator had raised far more money than any of his rivals, and his path both to the nomination and to the floor of the U.S. Senate seemed assured.

But his closest advisers sensed that the 42-year-old candidate and father of two — 5-year-old Malia and 2-year-old Sasha — was feeling a bit down and listless. As Valerie Jarrett later told biographer Richard Wolfe, she suggested that the candidate meet her for lunch at Chicago’s posh gym, the East Bank Club.

“What’s wrong?” Obama asked “the principal,” as he referred to his chief aide.

Jarrett replied, “Your heart isn’t in it. What’s wrong with you?”

“I miss my girls,” Obama said as tears welled up. “I don’t want to be the kind of father I had.” But after composing himself, he added, “I’ll work it out. I’ll be okay.”

For Obama, one of the most welcome byproducts of gaining the highest office in the land at the age of 47 was that he could finally differentiate himself from his own absentee father, Barack Obama Sr., and become the child-centric parent he had always longed to be. This hands-on dad, who helped coach Sasha’s grammar school basketball team, puts a high premium on both connecting with and providing direction to his girls.

For Dave Engledow, it all started with humorous photographs meant to capture the new father's exhaustion. (Jorge Ribas/The Washington Post)

By nature a nurturer, Obama is just one of a handful of presidents who have been exemplary dads — what child development experts call authoritative parents. This type of dad is loving but sets firm limits.

Based on my research, which consisted of a close examination of major biographies, immersion in family correspondence at various archives and some interviews with children and grandchildren of recent presidents, I have found that few presidents fall into this category. The other members of this small fraternity include James Monroe, Rutherford B. Hayes, Harry Truman and Gerald Ford. Truman doted on his only child, Margaret, who described herself as “a total Daddy’s girl.”

In contrast, the vast majority of Obama’s White House predecessors were consumed by politics and spent little time with their children.

Lyndon Johnson hardly ever even saw his young daughters, Lynda and Luci, during his days as Senate majority leader. Only after he suffered a heart attack in 1955 did LBJ begin to recognize that his life “was so lopsided as to be ridiculous … [and that] there was something else besides my job.”

While Jimmy Carter occasionally carved out time to play with his youngest child, Amy, he was an absentee dad to her three older brothers, Jack, Chip and Jeff. “[Dad] had his own thing to do,” Jack put it in 2003, “and I don’t think you get to be president unless you’re driven.”

Likewise, George Herbert Walker Bush often traveled back to his native Connecticut during the late 1950s and early 1960s, leaving his five children with family friends and relatives. “At least we weren’t put in a kennel,” remarked Jeb Bush.

As Obama has often said, the president “lives above the store” and has no commute. No longer has his hectic travel schedule required constant separations from his two girls. Malia was a summer baby — born on the Fourth of July in 1998 — and for the first three months of her life, Obama was glad to help his wife, Michelle, by changing diapers and rocking Malia to sleep. But once fall came, the state senator and part-time law professor had to be away from the family’s Chicago home at least half the week. And by early 2007, when he was both a U.S. senator and a full-time presidential candidate, Obama was forced to hand off just about all of the parenting responsibilities to Michelle.

He was eager to reconnect with his family. Soon after being inaugurated, Obama established what New York Times reporter Jodi Kantor has called “an unusual rule for a president.” As he informed all his aides, he vowed to have dinner with his family five nights a week. That left just two nights a week for out-of-town fundraisers or dinners with fellow politicians.

At 6:30, Obama and his wife sit down with the girls for a family dinner without any outsiders — not even Michelle’s mother, Marian Robinson, who typically retreats to her own “home” on the third floor of the White House.

The evening meal, observed Obama’s former body-man Reggie Love, was treated “like a meeting in the Situation Room. There’s a hard stop before that dinner.” While aides sometimes call him back to work at 8:30 or 9, they rarely dare to go upstairs to bother him during the sacred dinner hour.

On most days, Obama also eats breakfast with his daughters. And as part of his commitment to his girls, Obama has been reluctant to visit Camp David, since various school activities typically require the youngsters to be in Washington.

Obama is extremely proud of his résumé as a parent. He boasts of having read aloud with Malia all seven volumes of the Harry Potter series; in his first fall in office, he also managed to read all of Yann Martel’s “Life of Pi” to Sasha. But performing as a head of household did not come easily to him. As this supremely self-confident man acknowledged in 2006, “It is in my capacities as a husband and a father that I entertain the most doubt.”

In sharp contrast to his own neglectful father, this president with the perfect attendance record at his daughters’ parent-teacher conferences has emerged as a model father. Out of his own feelings of loss and alienation, which he described in “Dreams from My Father,” has come a road map for personal and social transformation. “I am a black man who grew up without a father, and I know the cost that I paid for that,” the president told a panel on Overcoming Poverty at the Catholic-Evangelical Leadership Summit held at Georgetown University in 2015. “And I also know that I have the capacity to break that cycle, and as a consequence, I think my daughters are better off.”

Obama seeks to turn his own story into public policy. The blight that now blankets devastated parts of cities such as Baltimore, he argues, can be addressed if more black men can be inspired to do for their children what their fathers never did for them. This was the impetus behind the president’s decision in 2014 to establish My Brother’s Keeper, a community-based initiative designed to help young men of color reach their full potential. Obama has hinted that he plans to stay involved in this cause long after his presidency is over.

For Obama, good parenting is a powerful tool for social transformation. It may also be a key component of his legacy.