SACRAMENTO — In front of state lawmakers weighing a slate of gun-control measures, the Dalai Lama said Monday that ending violence requires inner disarmament and an education system that focuses on teaching moral values, compassion and what it means to be a global citizen.

In a speech to lawmakers in the state Capitol, the Tibetan spiritual leader called a sense of community “the basis of our own happy future.”

His comments came in the wake of the mass shooting in Orlando and the deadly attack in San Bernardino in December, which led California lawmakers to introduce more than a dozen gun-control bills.

“Real gun control must come from here,” the Dalai Lama said, pointing at his heart.

The Nobel Peace Prize laureate also spoke to the Legislature of the need to care for the planet and the threat of climate change — a hallmark concern for Gov. Jerry Brown — in an address that diverged widely from his prepared comments.

Earlier in the day, the Dalai Lama met with Brown in a small, private luncheon at the historic Leland Stanford Mansion, the governor’s office said.

As he waded through the crowded Assembly chambers to the dais, the Dalai Lama quieted the room by urging clapping politicians to sit, saying he did not like such formalities.

He praised California for its focus on climate change, something he said he understands firsthand. He said his home, Tibet, is warming three times faster than the rest of the planet.

“This planet is the only place we can live happily, we can breathe happily,” he said. “There is no other choice but fully protect our home.”

Education is the best platform

The Dalai Lama also called on educators to do more to ensure that compassion, love and citizenry are at the core of what they teach.

“The generation who come from (the) existing sort of society (have a) very much materialist life, materialist culture,” he said. “I feel the existing education system (is) very much oriented about material value and not talking about our inner value.”

The Tibetan spiritual leader said that his generation has witnessed much violence and that today’s youths have an opportunity and a responsibility to create a better world.

However, he said, many places in the world are not preparing young people to grow into compassionate adults, noting religion is helpful in promoting inner peace, but that in a world of many nonbelievers, education is the best platform.

It was the Dalai Lama’s first trip to Sacramento and came five days after he met with President Obama at the White House, a session that angered China. Beijing leaders accuse the 80-year-old Dalai Lama of leading a campaign to divide Tibet from the rest of China by using religion as a cover for the political talks.

Tensions with China

Chinese Foreign Ministry spokesman Lu Kang said in a statement that meetings in the U.S. with the Dalai Lama send the wrong message to separatist forces that support Tibetan independence and could jeopardize the relationship between China and the U.S.

White House press secretary Josh Earnest said in a press briefing after the meeting last week that the U.S. has not changed its position on Tibet.

“Tibet, per U.S. policy, is considered a part of the People’s Republic of China, and the United States has not articulated our support for Tibetan independence,” Earnest said, according to a transcript of the media briefing.

The Dalai Lama has called for a higher degree of autonomy under Chinese rule.

He and his followers have lived in exile in the Himalayan hillside city of Dharamsala, India, since 1959, when they fled Tibet following a failed uprising against China.

The Tibetan government-in-exile, which elects its own prime minister and parliament, is not recognized by China. Earlier this year, the exiled government renewed calls for China to grant it autonomy.

The Dalai Lama led the exiled government until 2011, when he stepped down to focus on his role as a spiritual leader.

Melody Gutierrez is a San Francisco Chronicle staff writer. Email: mgutierrez@sfchronicle.com Twitter: MelodyGutierrez