The General Assembly on Wednesday confirmed Andrew J. McDonald, a former Democratic state senator and longtime confidant of Gov. Dannel P. Malloy, as the first openly gay justice of the Connecticut Supreme Court. McDonald, 46, of Stamford was confirmed on votes of 30-3 in the Senate and 125-20 in the House, clearing the way for him to resign as Malloy's general counsel and join the state's highest court Thursday. As the long-time co-chairman of the legislature's Judiciary Committee, McDonald was an influential legal voice in Connecticut. He resigned from the Senate two years ago to join the Malloy administration as legal adviser, a role he played in Stamford when Malloy was mayor. His sexual orientation was not addressed during a debate in which opponents focused on his lack of previous judicial experience and his sponsorship of a bill in 2009 that Catholics deemed an intrusion into church affairs. All 23 legislators opposing his nomination were Republicans, though the ranking GOP House and Senate members of the legislature's Judiciary Committee, which screens nominees, pronounced him qualified, as did the leaders of the Republican minorities in the House and Senate.