A federal judge’s decision last week to strike down Utah’s ban on same-sex marriage came as such a surprise to state officials that at least one county clerk wasn’t able to make arrangements to open his office to issue marriage licenses the next day, a Saturday.

But after two years in which legislatures, voters and courts around the country have moved to legalize same-sex marriage or strike down bans against marriage equality, other state and local officials might want to prepare to keep the lights on: The battle over same-sex marriage is shifting to federal courts.

Twin decisions earlier this year by the U.S. Supreme Court striking down the federal Defense of Marriage Act and invalidating Proposition 8, the California measure that outlawed same-sex marriage, have pushed judges in several states to rule against bans on gay marriage. The state Supreme Courts in New Mexico and New Jersey both declared same-sex marriage legal, and on Monday, a federal judge in Ohio said the state must recognize same-sex marriages performed in other states, though in a narrow ruling that applies only to death certificates.

Evidence suggests that next year, the pace of change may speed up.

Judges in 17 states are considering at least 31 cases seeking to allow gays and lesbians to marry, according to a private count kept by one LGBT group and shared with The Washington Post. Same-sex couples in states ranging from deep red Arkansas, Louisiana and Mississippi to purple North Carolina, Nevada and Virginia are suing, many citing this year’s Supreme Court decisions, which other federal judges have recognized.

Political reality has forced same-sex marriage backers out of state legislatures and into federal court. After two years of winning legislative and electoral battles, primarily in states controlled by Democratic legislatures and governors, same-sex marriage supporters have only one more chance to change a state’s laws on the ballot — in Oregon, where a measure to legalize marriage will almost certainly be on the ballot next November.

But the legislative victories, coupled with the court decisions, have added up to a remarkably rapid change in the number of states that allow same-sex couples to marry.

In just the past 12 months, legislatures, voters or courts in 11 states have allowed same-sex marriage. Legislatures passed bills in Washington, Maryland, Rhode Island, Delaware, Minnesota, Hawaii and Illinois; voters upheld those decisions in Washington and Maryland, and legalized same-sex marriage in Maine. The Supreme Court earlier this year ruled against California’s Proposition 8, which invalidated same-sex marriages.

At the same time, the court ruled the federal Defense of Marriage Act was unconstitutional, a move that judges in several states — New Jersey, New Mexico and Utah — have cited in declaring state bans on same-sex marriage unconstitutional.

That means, barring another decision in the next week, 2013 will end with 18 states and the District of Columbia recognizing same-sex marriage in some form — states that account for 228 electoral votes and 123 million people, nearly 40 percent of the U.S. population. Oregon, Nevada, Wisconsin and Colorado, which account for another 32 electoral votes and 17.5 million residents, recognize civil unions, domestic partnerships or other legal status for same-sex couples.

With so many cases before federal judges, it is likely that 2014 will be the year in which states accounting for a majority of Americans will allow gay marriage.

The pace of change over the last two years is especially notable when considering the politics of the last decade. Ten years ago, support for same-sex marriage was so far outside the mainstream in American politics that the Democratic candidate for president of the United States, John Kerry, reaffirmed his opposition several times. Advocating gay marriage was a position reserved for a small slice of coastal liberals.

A decade later, as 2013 draws to a close, the sea change of public opinion has been so swift and dramatic that support for same-sex marriage has become a majority opinion — and the pace of change suggests 2014 will be the year in which a majority of Americans live in states in which gay marriage is legal.

The shifting opinions on gay marriage is fueled by the growing influence of a younger generation and the evolving attitudes of older Americans. A Washington Post/ABC News survey, conducted May 1-5, 2013, showed 55 percent of Americans support allowing gays and lesbians to marry legally; seven in 10 Americans between the ages of 18-39 said they support same-sex marriage.