An early celebration of John F. Kennedy’s birthday on Wednesday offered top Beacon Hill officials a venue to criticize national politics and the federal government as they contrasted the Kennedy White House with the current administration.

Without mentioning President Donald Trump by name, speakers alluded to his immigration policy and called on Massachusetts lawmakers to defend the values of freedom and democracy.

As part of his tribute to the 35th president, Gov. Charlie Baker said he wonders what Kennedy would think “of our current state of affairs.”

“I suspect the coarseness of modern-day politics would disappoint him,” Baker said. “I think he would remind us that in his day he asked us to focus not on what our country can do for us but to instead remember what we can do for our country. I call those words to live by, now more than ever.”

Baker spoke during a joint session of the Legislature held to mark the centennial of Kennedy’s birthday, May 29, 1917. The governor, House Speaker Robert DeLeo, Senate President Stanley Rosenberg and Kennedy’s niece, former Maryland Lt. Gov. Kathleen Kennedy Townsend, each reflected on Kennedy’s impact.

Rosenberg said the country is at a “critical juncture” where the “people and institutions that made us great are under attack.”

“There is no better time to remember what President John Kennedy stood for, his values, his traditions, his courage, his ambition to uphold the constitution and the rule of law, to welcome immigrants the way that his family had been welcomed, and to raise his voice in hope,” Rosenberg said.

DeLeo recalled seeing Kennedy’s photo hanging on a wall in his grandmother’s house along with pictures of saints and popes, all Italian. He said Kennedy “made us a more inclusive nation.”

Kathleen Kennedy Townsend drew applause from lawmakers when she discussed her uncle’s views on immigration, saying he learned from his own family that immigrants were “gutsy and courageous” and later pushed for immigration law changes “to open doors to people from all over the world, not just his beloved Irish.”

She said Kennedy’s values of courage, integrity, judgment and dedication would “stay active in our souls” during his centennial year.

“We won’t back down,” Kennedy Townsend said. “We will stay true to our legacy. Why? Because this state, this Massachusetts, has a love of democracy and like President Kennedy we will make America’s work our own.”