By Sharon Bernstein

(Reuters) - They wore pantsuits to their polling places, emulating the preferred dress of their White House candidate. Some wept with emotion and others remembered their female ancestors as they cast their vote for Democrat Hillary Clinton.

But rather than witness the shattering of the ultimate glass ceiling, women across America watched an historic breakthrough slip away as Clinton failed to become the first woman elected president of the United States.

Republican Donald Trump, who had waged a heated campaign painting the former secretary of state as "crooked" and threatening to put her in jail, swept to surprise victory on an anti-establishment platform.

"I was looking forward to having a woman president. I really was. I can't believe people voted for that terrible man," said Mariana Mejia, 61, sitting at a subdued party at California Democratic Party headquarters in Sacramento.

Some women defied their own political tradition to vote for the first woman presidential nominee of a major U.S. political party. Republican Cassandra Pye, a pioneering African-American political consultant who advised former California Governor Arnold Schwarzenegger, said she felt the pull of history as she cast her ballot for Clinton.

"I feel like even though I vote in the booth alone, there are always people in there with me," Pye said. "My ancestors, my mother, my aunties - there were a lot of people in the booth with me today."

A polarizing figure with a long history in the public eye, Clinton entered the White House as first lady in 1993, after her husband, Bill Clinton, defeated incumbent George H. W. Bush.

Her ambition immediately clashed with the public's image of a first lady, and Clinton won enemies as swiftly as she earned the adoration of many progressive women.

When she lost the Democratic nomination to Barack Obama in 2008, Clinton conceded that "although we weren’t able to shatter that highest, hardest glass ceiling this time, thanks to you, it’s got about 18 million cracks in it," referring to the number of votes she had won.

'A VERY HARD STRUGGLE'

Women who had pinned their hopes on Clinton gave a nod to their political history on Tuesday, forming a long line to leave "I Voted Today" stickers on the gravestone of women's suffrage activist Susan B. Anthony.

Others, dressed in white like the suffragettes who campaigned for a woman's right to vote and wearing pantsuits like those favored by Clinton, posed for photos at state Capitol buildings and other iconic locations.

Several bemoaned the fact that U.S. women won the right to vote in 1920 and nearly a century later the country has yet to elect a woman president.

"It's been such a hard struggle for women, a very hard struggle," said U.S. Senator Barbara Boxer, who in 1992 made history along with Senator Dianne Feinstein as the first women elected from California to the U.S. Senate. "It's a very emotional moment."

Trump, a wealthy real estate developer and former reality TV star, defied political correctness with comments that angered women, minorities and the disabled. He denied allegations by several women that he groped them after the emergence of a video where he boasted about making unwanted sexual advances on women.

At the Sacramento Democratic party gathering, some women lamented his victory and the long, difficult trek for women to win positions of power.

"I thought by the time I hit 61 it would be different for women and minorities," said Chris Cage, 61, a former journalist and labor organizer. "I see a victory for Trump as a vote against both."

(Additional reporting by Ben Klayman in Detroit, Scott Malone in Boston, and Lisa Richwine and Nichola Groom in Los Angeles; Editing by Mary Milliken)