President Obama and India's Prime Minister Narendra Modi visit the Martin Luther King Jr. Memorial on the National Mall in Washington. (Larry Downing/Reuters)

It was a moment of sheer diplomatic poetry.

When President Obama showed India’s Prime Minister Narendra Modi around the Martin Luther King Jr. Memorial on Tuesday, history seemed to come full circle.

Many Indians take pride in the fact that King drew much inspiration from Mohandas Gandhi’s teachings of nonviolence and civil disobedience. And here was America’s first black president, a living embodiment of King’s dream, showing an Indian leader the monument to King’s struggle.

It was a reminder that the world’s oldest and largest democracies share an ideological heritage that links them more powerfully than talks and treaties about trade and politics.

King spoke often of Gandhi, so much so that his friends urged him to visit India after the Montgomery bus boycott ended and before he delved into another battle against segregation. He went to the subcontinent in 1959, along with his wife, Coretta Scott King.

Obama and Modi talk at the Martin Luther King Jr. Memorial. (Larry Downing/Reuters)

“Since being in India, I am more convinced than ever before that the method of nonviolent resistance is the most potent weapon available to oppressed people in their struggle for justice and human dignity,” King wrote in a 1959 piece for Ebony magazine, titled “My Visit to the Land of Gandhi.”

As a gift, Modi brought Obama several items of King memorabilia from that trip. According to the Indian Embassy in Washington, they include a framed photograph of King laying a wreath at Gandhi’s tomb, and an audiotape of a speech King gave to All India Radio.

Modi was already planning to visit the King memorial by himself, just before a luncheon held in his honor at the State Department. In what apparently was a spontaneous gesture, Obama decided to tag along.

White House spokesman Josh Earnest noted that Obama had visited Gandhi’s house during a visit to India four years ago. The link was clear.

“There was a discussion between the president and the previous prime minister, Prime Minister Modi’s predecessor, about the intellectual relationship between Gandhi and Martin Luther King, and that they pursued, in trying to bring about a change in their countries, a similar commitment to nonviolence that I think Prime Minister Modi and certainly President Obama greatly admires,” Earnest said.

Though the two leaders could not be overheard, they were seen chatting as they walked past the giant stones with the kind of King quotations that draw goosebumps. From afar, Obama appeared to be pointing out the significance of what they were viewing.

Some hoped one of the topics that came up was related to violence in Gujarat state in 2002, when Hindu pilgrims clashed with Muslims and more than 1,000 people died, most of them Muslims. Modi has been dogged by allegations that he did nothing to compel his state’s security forces to quell the violence, and the U.S. denied him a visa in 2005.

“Of course, no one expected Obama to mention publicly the Gujarat violence, but we had thought he could communicate concerns about the risk of future sectarian violence,” said John Sifton, Asia advocacy director at Human Rights Watch. “And I certainly hope he did so when Modi and he walked together at the MLK memorial.”

The visit to the King memorial lasted long enough that Modi arrived about an hour late to a luncheon held in his honor at the State Department in the Benjamin Franklin State Dining Room, an elaborate expanse the size of a ballroom and decorated with eight chandeliers and antiques from the 18th and 19th centuries.

The lateness had a diplomatic side effect. Modi was eating nothing, because he is in the middle of a nine-day religious fast.

Secretary of State John F. Kerry and Vice President Biden, the co-hosts, pointed out how much India and the U.S. have in common. Modi effusively thanked his hosts for all the attention paid to him during his time in Washington. Though he offered no specifics, he said India was committed to change.

“India is ready to march ahead,” he said. “Step by step.”

And then Modi left, while about 250 guests in attendance dined on food catered by Washington’s fashionable Rasika restaurant.

katie.zezima@washpost.com