PROVIDENCE — Restaurants in Rhode Island would be prohibited from providing plastic straws unless customers specifically request them, under legislation introduced by Senate Majority Leader Michael J. McCaffrey.

The Warwick Democrat said the bill is aimed at cutting down on plastics pollution.

“You have to consider how much plastic is being put into the environment on a daily basis,” McCaffrey said. “If we keep one straw out of the ocean, it could save marine life.”

The bill was modeled on a California law that went into effect Jan. 1. McCaffrey said he read about the law and decided that something similar could work in Rhode Island.

According to the legislation, food service establishments that violate the law would be given notices of violation the first and second times, but any subsequent offenses would be punished with $25 fines, with an annual cap for any business of $300.

The Rhode Island Hospitality Association, which represents restaurants in the state, supports the legislation, Dale J. Venturini, the group’s president and CEO, said in an email: “We are committed to working with Leader McCaffrey on this important issue.”

The bill comes as a task force created by Gov. Gina Raimondo is in the midst of discussions around ways to reduce plastics pollution in Rhode Island. The group is considering a number of options, including a statewide ban on plastic bags.

While a number of cities and towns — including Barrington, Newport and others — have taken action on plastics, primarily by enacting bag bans, statewide bills have failed to win passage.

“Obviously,” he said, “they’ll have a chance to present their views.”