Apple CEO Tim Cook said that so-called “religious objection” legislation being introduced in a number of states is dangerous and bad for business.

The bills, like the one enacted last week in Indiana, create a legal framework for individuals, mostly business owners, to claim that a law or regulation mandated by the government infringes on their religious beliefs.

Two bills were introduced in the North Carolina General Assembly last week: Senate Bill 550, titled the “NC Religious Freedom Restoration Act,” and House Bill H751 by the same title.

“The purposes of this Article are to ensure that in all cases where State action burdens the 14 exercise of religion, strict scrutiny is applied; and to provide a claim or defense to a person or 15 persons whose exercise of religion is burdened by State action, the Senate bill reads.

In part, the House bill reads: “The State shall not substantially burden a person’s free exercise of religion, even if the burden results from a rule of general applicability, unless the State demonstrates that application of the burden to the person is in furtherance of a compelling State interest and that the State used the least restrictive means of furthering that compelling State interest.”

In an op-ed piece for The Washington Post, the leader of the nation’s largest corporation said that the bills under consideration “have the potential to undo decades of progress toward greater equality.”

He cited actions taken by lawmakers in Texas, Indiana and Arkansas, but said that a “wave of legislation” has been introduced in more than two dozen states.

Cook said he was opposing the legislation on behalf of Apple Inc. He came out as gay in October, saying that he wanted to make a difference for others.

In a letter he wrote then, Cook said, “there are laws on the books in a majority of states that allow employers to fire people based solely on their sexual orientation. There are many places where landlords can evict tenants for being gay, or where we can be barred from visiting sick partners and sharing in their legacies. Countless people, particularly kids, face fear and abuse every day because of their sexual orientation.”

Cook said in his criticism of religious objection laws that he has great respect for religious freedom, but that it can never be “used as an excuse to discriminate.”

The legislation is not a political or religious issue, but rather “about how we treat each other as human beings,” Cook said.

“Opposing discrimination takes courage. With the lives and dignity of so many people at stake, it’s time for all of us to be courageous,” Cook said.

Last week, Cook joined a long list of magnates promising to give away most of the wealth that they amass during their careers.

Cook mentioned his intentions in a story about him published Thursday by Fortune magazine. After paying for the college education of his 10-year-old nephew, Cook says he will donate the rest of his money to philanthropic causes.

Apple Inc. declined to comment Friday.

The charitable commitment echoes pledges made by other executives far richer than Cook, who is 54.

Microsoft co-founder Bill Gates, Berkshire Hathaway CEO Warren Buffett and Oracle Chairman Larry Ellison are among more than 120 wealthy people and families who have announced they will give away their fortunes. Gates, Buffett and Ellison each have a net worth of at least $54 billion and rank among the five richest people in the world, according to Forbes magazine.

Most of Cook’s wealth is tied up in an Apple grant of restricted grant that he received in 2011 when he succeeded Steve Jobs as Apple’s CEO. That grant is now worth about $860 million. Most of the restricted grant will vest in separate tranches next year and in 2021.

Apple can rescind some of the restricted grant if the company’s stock lags the performance of the Standard & Poor’s 500 for an extended stretch. That hasn’t been an issue during the past year, with Apple’s stock surging by about 60 percent to lift the company’s market value above $700 billion. The S&P 500 has gained 11 percent over that period.

Since Cook became CEO, Apple’s stock has more than doubled to create about $370 billion in shareholder wealth. The Cupertino, California, company also has paid out about $27 billion in shareholder dividends.

Cook signaled his interest in philanthropy early in his tenure when he set up a program committing Apple to match each of its employees’ donations up to $10,000 annually.