Having survived weeks of behind-the-scenes scheming, an obscure textbook bill that elicited threats from Japan and drew busloads of Korean activists to the Capitol was headed Wednesday to Gov. Terry McAuliffe for his signature.

McAuliffe (D) had promised on the campaign trail to support legislation requiring that any new Virginia textbooks note that the Sea of Japan is also known as the East Sea. It was a move meant to win voters in Northern Virginia’s large Korean American community, where “Sea of Japan” is considered a holdover from Japanese occupation.

The promise angered Japan, one of Virginia’s largest trading partners and biggest sources of foreign investment. The Japanese ambassador sent McAuliffe a letter suggesting that the legislation would damage trade relations. The embassy also hired a team of prominent Richmond lobbyists to try to thwart the legislation in the Capitol.

McAuliffe spokesman Brian Coy reiterated Wednesday that the governor would sign the bill.

“He made a campaign promise to sign it, and he’s going to honor his promise,” Coy said.

While McAuliffe never publicly backed away from the legislation, he and top aides quietly pressed legislators behind the scenes to kill identical House and Senate bills. Their efforts paid off — but only on one side of the Capitol.

“This puts the governor on the hot seat because he has 140,0000 Korean Americans who are very uncomfortable with the maneuvering that took place to kill this bill,” said Sen. Richard H. Black (R-Loudoun), who co-sponsored the Senate measure with Sen. Dave W. Marsden (D-Fairfax). “I haven’t seen him do anything where he’s worked harder to kill a bill than to kill the East Sea bill.”

Sen. L. Louise Lucas (D-Portsmouth) left the House version to die in the committee she chairs. Lucas questioned why the legislature should heed the demands of Korean Americans when it had rejected a bill in 2003 to make textbooks better reflect African American history.

It appeared that the Senate bill might meet the same fate in the House. Del. R. Steven Landes (R-Augusta) had written a floor amendment meant to kill the bill, which he feared would bring endless political and territorial disputes to the House Education Committee, which he chairs.

The amendment would have required that textbooks also give “due acknowledgment” to the “cultural contributions by African Americans and Virginia Indians.” If approved, the amendment would have likely killed the underlying bill since, just days before the session’s scheduled conclusion Saturday, the altered legislation would have needed to return to the Senate for approval of the changes.

Members of the black caucus were ready to back Landes’s amendment. But Republican leaders, who did not want McAuliffe to get off the hook so easily, were not in favor. Landes never proposed it. Instead, on Wednesday, Del. Jennifer McClellan (D-Richmond) did.

“For years, our textbooks said that the slaves were happy,” McClellan said.

House speaker William J. Howell (R-Stafford) ruled that the amendment was not germane to the underlying legislation. The bill passed 82 to 16 — a great victory and introduction to democracy for a relatively new immigrant group, Marsden said.

“These people came to this country, they worked hard, raised their families, created businesses, played by the rules,” he said. “And I think this very small gesture is a great way for Virginia to say, ‘Welcome.’ ”

The legislation’s twists and turns were befuddling to large groups of Korean Americans who followed the process closely along with Korean and Japanese media crews. As one bill died and the other was imperiled earlier this week, Korean activist Peter Kim was left scratching his head.

“This thing has passed [by] more than 80 percent in both [the] House and Senate,” he said. “If this thing gets killed or something goes wrong, to me somehow the democratic system’s not working properly.”