Sandra Day O’Connor, who became the Supreme Court’s first female justice in 1981 and then one of its most influential members before retiring, announced Tuesday that she suffers from dementia and is “no longer able to participate in public life.”

In a letter released by her family, O’Connor, 88, said she wanted to “be open about these changes, and while I am still able, share some personal thoughts.”

She added: “How fortunate I feel to be an American and to have been presented with the remarkable opportunities available to the citizens of our country. As a young cowgirl from the Arizona desert, I never could have imagined that one day I would become the first woman justice on the U.S. Supreme Court.”

O’Connor was nominated to the court by President Ronald Reagan, who fulfilled a campaign pledge to name the first female justice. She served for a ­quarter-century, leaving in 2006 to take care of her husband, John, who had been diagnosed with Alzheimer’s disease.

Since leaving the court, she had heard cases in courts of appeals across the country and promoted the teaching of civics to students.

The nonprofit she founded, iCivics, has created 19 games and hundreds of digital lesson plans, on topics such as how to run a presidential campaign and how local governments work. According to the foundation, its games were played more than 5 million times last year in school by K-12 students.

O’Connor has been in poor health in recent years. Like other retired justices, she is entitled to hire a clerk, but she last hired one for the term that began in October 2015.

The timing of the announcement seems to have come partly because of changes at the court. Her son Jay O’Connor told the Associated Press that over the past year the family has cleared out her chambers at the court and gone through hundreds of boxes of files and other items she had in the building’s basement.

Among the items donated to the court, the Library of Congress and the Smithsonian: a gavel used at her 1981 confirmation hearing, her Presidential Medal of Freedom and T-shirts made annually by an exercise class she started at the high court.

Newly retired justice Anthony M. Kennedy is moving into her chambers, opening up a series of office changes to create space for Justice Brett M. Kavanaugh.

O’Connor, who was born in El Paso, lives near her home in Phoenix.

One of her last interviews was in 2016, after the death of Justice Antonin Scalia. She said she did not agree with the strategy of Republican senators to keep the post open until after the presidential election.

In her letter Tuesday, O’Connor said that she hoped others would take the lead in promoting civics and that she would be watching from the sidelines.

“I feel so strongly about the topic because I’ve seen first-hand how vital it is for all citizens to understand our Constitution and unique system of government, and participate actively in their communities,” she wrote.

O’Connor’s departure from the court marked a moment much like the present one. She was seen as a moderate conservative, with a pragmatic approach that often made her the pivotal member. She was replaced by Justice Samuel A. Alito Jr., who was more conservative and moved the court to the right.

The court likely faces a similar move with conservative Kavanaugh replacing the more moderate Kennedy.

O’Connor was not always happy with the way the court changed after she left.

Interviewed in front of an audience in 2009, she said: “What would you feel? I’d be a little bit disappointed. If you think you’ve been helpful, and then it’s dismantled, you think, ‘Oh, dear.’ But life goes on. It’s not always positive.”

O’Connor was enthusiastic, however, about seeing three women on the court.

Chief Justice John G. Roberts Jr. in an accompanying statement called O’Connor a trailblazer.

“Justice O’Connor is of course a towering figure in the history of the United States and indeed the world,” he wrote. “She broke down barriers for women in the legal profession to the betterment of that profession and the country as a whole. She serves as a role model not only for girls and women, but for all those committed to equal justice under law.”

He said he was not surprised that she used the occasion “to think of our country first, and to urge an increased commitment to civics education, a cause to which she devoted so much of her time and indomitable energy.”

Robert Egge, chief public policy officer of the Alzheimer’s Association, said O’Connor had been active with his organization as well.

“Driven by her own experience” caring for her husband when he had dementia, “Justice Sandra Day O’Connor channeled this passion into her work as a critical member of the Alzheimer’s Study Group,” Egge said in a statement. “She played an important role in making Alzheimer’s the national priority it is today.”

There are now four living retired Supreme Court justices. Besides O’Connor and Kennedy, 82, David Souter, 79, continues to hear cases on the U.S. Court of Appeals for the 1st Circuit in Boston, and John Paul Stevens, 98, gives speeches and writes books.