An American Airlines Boeing 787 (front) and Delta Airlines Airbus A350 aircraft (background, obscured) wait to take off at Beijing airport on July 25, 2018. - Beijing hailed 'positive steps' as major US airlines and Hong Kong's flag carrier moved to comply on July 25 with its demand to list Taiwan as part of China, sparking anger on the island.

The union that represents American Airlines pilots said Thursday that it's suing the carrier to halt service to China amid the coronavirus outbreak, which has killed more than 170 people in China and infected more than 8,000 around the world.

The Allied Pilots Association, which represents about 15,000 pilots for the Fort Worth, Texas-based carrier said its suit seeks a temporary restraining order to halt all American Airlines service between the U.S. and China.

American on Wednesday announced it would suspend its Beijing and Shanghai flights from Los Angeles between Feb. 9 and March 27, citing reduced demand because of the coronavirus outbreak, following similar moves by dozens of airlines around the world.

APA's lawsuit says American still operates approximately 56 monthly flights between Dallas/Fort Worth International Airport and destinations in China. APA President Capt. Eric Ferguson is calling for American Airlines pilots to refuse to fly to and from China.

[To see the latest updates on the coronavirus, visit CNBC's live blog here.]

"The safety and well-being of our crews and passengers must always be our highest priority — first, last, and always," Ferguson said. "Due to the known and unknown risks associated with traveling to China right now, concurrent with the filing of our lawsuit, we are directing all American Airlines pilots assigned to flights between the United States and China, other than those on return trips to the United States, to decline the assignment."

In a statement, American said the airline was aware of the filing and referred to the flight suspensions announced Wednesday. "We are in close contact with the CDC and global public health officials to make sure we are taking all necessary precautions for our customers and team members," the statement said. "We will continue to monitor the situation and make any updates as needed."

Federal regulations require crew members flying to China to remain on the ground for approximately 32 hours to rest between flights, the APA said.

American and the pilots union are in the middle of contentious contract negotiations, but the union said the suit was a separate safety matter and neither a part of the talks nor would it affect them.

Airlines' China service cuts have increased as the coronavirus spreads, hurting demand for service to the country. Delta Air Lines said Wednesday it is cutting flights to China in half starting Feb. 6 through April 30 as the coronavirus spreads, driving down demand for flights to the country. United Airlines on Tuesday announced it is canceling dozens of China flights next month because of a "significant decline in demand" for service, and announced more cuts on Thursday. British Airways, Cathay Pacific and Lufthansa have also slashed or reduced service.

"While the additional cancellations are based on passenger demand, it will also mitigate the health risk to passengers and crews," the Association of Flight Attendants, which represents United's cabin crew, said in a statement Thursday. "We encourage all airlines to follow United's lead. Together, we can keep people safe, eliminate this public health threat, and more quickly return the industry to full operation."

The union that represents Delta pilots said Thursday they have reached out to flight operations management with a request to allow pilots the option "to remove themselves from flying to China during this ongoing situation."

"Delta has agreed to follow past-practice from similar situations," the union said. "Specifically, if a pilot has concerns about flying to China, the pilot should contact the chief pilot office to share those concerns. If a regular line holder cannot swap or drop a trip to China and does not want to fly there, the chief pilot office will drop the trip without pay. If a reserve line holder is assigned a trip to China, the reserve pilot may bypass the China assignment and return to reserve on-call status with no pay hit."