The legal battle over gay marriage, which began in a Massachusetts courthouse more than a decade ago, arrives at the highest court in the land this week, with the Supreme Court scheduled to hear two cases that could dramatically reshape the debate.

The oral arguments before the nine justices, likely to be the most closely watched of the term, come as public support for gay marriage is at an all-time high, according to public opinion surveys. Fifty-eight percent of Americans favor marriage rights for gay people, according to a Washington Post-ABC News poll published last week. Thirty-six percent opposed gay marriage.

Support for gay marriage is overwhelming among young American adults: 81 percent of those ages 18-29 support marriage rights for gay people, according to the survey, mirroring findings in other polls.

“It will be interesting to see what impact, if any, the huge change in public opinion might have directly or indirectly on the justices,” said Massachusetts Attorney General Martha Coakley, who will attend part of the arguments in Washington this week. “We know that [justices] are people who do not totally live in a bubble anymore. They are very much aware of what is happening in the country.”

The Supreme Court is scheduled to hear arguments Tuesday in a California case challenging Proposition 8, a voter-approved state prohibition on same-sex marriage. Lower courts have struck down the prohibition as unconstitutional. Opponents of same-sex marriage appealed to the Supreme Court to maintain the ban.

Then on Wednesday, the court is expected to hear a challenge to the Defense of Marriage Act, known as ­DOMA, a federal law passed in 1996 and signed by President Clinton, which says same-sex married couples cannot receive federal marriage benefits. Clinton recently renounced the law and recommended it be overturned.

President Obama’s administration has concluded ­DOMA is unconstitutional and declined to defend it from legal attacks.

The leadership of the House of Representatives is defending DOMA in court. House Speaker John Boehner said the courts should decide the law’s constitutionality, not the president.

Coakley, who filed a brief urging the court to strike down DOMA as unconstitutional, led the first state challenge to the law in 2009. She said she will be watching the justices for hints, “particularly on our matter, which talks about the right of a state to define marriage and to challenge a federal government that has a different definition of marriage, imposing a burden on the state for no appreciable reason.”

The court could offer sweeping rulings on whether or not gay people have a constitutional right to marry or the court could sidestep the big issues raised by the cases and decide them on narrow, technical grounds, said Carl W. Tobias, a professor at the University of Richmond School of Law.

He identified two key conservative judges likely to be the swing votes: Anthony Kennedy and Chief Justice John Roberts.

Kennedy has written previous opinions supporting gay rights, including in a ground-breaking 2003 case striking down state laws that criminalized sodomy.

Roberts joined the court’s liberal wing last year as the surprise swing vote in a 5-4 decision to uphold President Obama’s health care overhaul.

“Roberts is always concerned about the court’s reputation as an institution and its credibility,” said Tobias, who believes Roberts will note the obvious trend of public sentiment toward marriage rights for gay couples, especially the overwhelming support among young people. “When the court has gone against overwhelming numbers, eventually it has had to back down,” and overturn previous decisions.

Decisions on both cases are expected to be handed down by summer.

Neither of this week’s cases would be in the Supreme Court if not for a Massachusetts lawsuit that led to the Bay State becoming the first to establish gay marriage rights, in 2004.

“In Massachusetts we broke an historic barrier and in doing so it changed the discussion forever,” said Mary L. Bonauto, civil rights project director at the anti-discrimination group GLAD and lead counsel in the Massachusetts case that led to gay marriage. “Finally people had a chance to see what it could look like when same-sex couples could join in marriage.

“Part of why I think there has been dramatic change on this issue the past 10 years is because the reality of the situation became visible to people,’’ she said. “The fears have not entirely gone away, but the fears have dissipated overall and it has brought rationality into the discussion.”

Since Massachusetts became the first state in which gays could legally marry, eight states have followed. Several others have passed bans on gay marriage.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.

Thanks & Welcome to Globe.com

You now have unlimited access for the next two weeks.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.