A view of the Maryland State House in Annapolis on April 8, 2014. (Patrick Semansky/AP) (Patrick Semansky/AP)

The Maryland Senate voted Thursday to remove references to the Confederacy from the official state song and replace the controversial portions of the historic anthem with a verse from a poem that describes the state’s natural beauty.

The 38-to-8 vote came after a protracted debate about how Maryland should address its painful past.

Supporters of the bill said the song titled “Maryland, My Maryland,” written by James Ryder Randall in 1861, is not unifying and does not represent Marylanders, then or now.

Randall wrote the song while he was upset over the death of a friend who was shot while protesting Union troops as they marched through Baltimore. It calls for Marylanders to take up arms and join the South in its battle against the Union, calls Northerners “scum,” and describes President Abraham Lincoln as a tyrant.

The bill passed by the Senate on Thursday calls for some of Randall’s lyrics to be replaced with a verse from a poem written by John T. White in 1894. The bill now moves to the House for consideration.

“I think it’s time to get rid of the verse that basically criticizes and makes us look bad,” said Sen. Ronald N. Young (D-Frederick). “The [song] is degrading to Maryland and should not represent us moving forward.”

Opponents of the bill argued that if Maryland was on the wrong side of history, its residents should learn from that past rather than erase it.

“Our history has some pretty bad blemishes on it,” said Sen. Robert G. Cassilly (R-Harford). But the state should “use it as a teaching point and move forward. . . . The idea of excising our history, that’s not America.”

Also Thursday, the Senate voted — as expected — to approve Gov. Larry Hogan’s $42.3 billion budget, with dozens of minor amendments. It is the second year in a row that the Senate has voted unanimously to pass the budget, which now heads to the House.

Recalling that Republicans voted in favor of the budget last year but ended up opposing the measure after Hogan expressed reservations, Senate President Thomas V. Mike Miller Jr. (D-Calvert) told them that this year, they “need to hold fast.”

Hogan thanked the Senate and Miller for the vote but raised concerns about a plan to reduce the state’s rainy-day fund and to reallocate certain spending. He also urged lawmakers to pass a bill he has proposed that would limit automatic spending increases.

“In order to keep moving forward, and to build upon the progress of the past year, we must continue to focus on our long-term finances, live within our means, and strive for the much-needed mandate and tax relief our citizens expect and deserve,” Hogan said in a statement.

With less than a month left in the 90-day session, the General Assembly is moving quickly to deal with a backlog of bills. The House held a morning session, broke for committee voting and then returned for an evening session. It also planned to meet Saturday morning.

The House on Thursday also approved a bill that would require the state to reduce its greenhouse-gas emissions by 40 percent within the next 14 years, compared with 2006 levels.

The measure would build on a 2009 Maryland law that requires the state to cut emissions by 25 percent by 2020.

A similar bill was already approved in the Senate; now one version must be passed in the opposite chamber in order to go to Hogan for his signature.

In other action, the Senate voted in favor of a bill that would hold energy companies financially liable if their fracking operations cause injury, death or loss of property.

It also gave final approval to a bill that would change a requirement that people notify a local or state government of their intent to sue. The bill does away with the notification requirement when the claim is on behalf of a child or someone with a disability.

The measures now head to the House for consideration.