Apple CEO Tim Cook on Friday strongly defended consumers, saying "everyone has a right to privacy and security."

The head of the world's biggest technology company, speaking at President Barack Obama's cybersecurity summit in Palo Alto, Calif., called for the government and other companies to work together to make sure consumers are protected.

"When it comes to the rights of customers and the rights of citizens, it's important to realize we're all talking about the same people," Cook said. "We owe them nothing less but the best protections that we can possibly provide by harnessing the technology at our disposal and working together...We must get this right."

Cook, who came out as gay last year, added that "history has shown us that sacrificing a right to privacy can have dire consequences," and that we still live in a world where people aren't treated equally and can face discrimination based on personal information.

"If those of us in positions of responsibility fail to do everything in our power to protect the right of privacy, we risk something far more valuable than money," Cook said. "We risk our way of life. Fortunately, technology gives us the tools to avoid these risks. And it is my sincere hope that by using them and by working together, we will."

The White House's summit, held at Stanford University, assembled leaders from all sectors of business, and across industries, to find new ways to improve security against cyberthreats.

Obama's early years in office involved a close relationship with Silicon Valley, but those ties have frayed in recent months as the government has asked tech companies for access to their user data. Obama on Friday plans to sign an executive order to promote sharing of information on cybersecurity threats among businesses and between the private sector and government agencies.

Apple, in contrast to many other technology companies, has taken a strong stance to protect user privacy. The company makes money from selling hardware and from services like iTunes, not from selling user data. Google, Facebook and others largely generate revenue from selling targeted advertising. But like Apple, those companies have fought against government data requests and have taken steps to protect user privacy. Top executives from Google, Facebook and Yahoo turned down invitations to attend the summit Friday.

Cook in September published a lengthy letter detailing Apple's privacy and security policies. Part of the letter sought to reassure Apple's customers that their data was safe from the prying eyes of government surveillance agencies, which have reportedly procured information on electronic communications from Google, Microsoft, and Yahoo, among others. Cook said Apple has never worked with any government agency to create backdoors in Apple products, and data on devices running iOS 8, the mobile operating system Apple released in September, is protected by users' personal pass codes that Apple can't bypass.

"So it's not technically feasible for us to respond to government warrants for the extraction of this data from devices in their possession running iOS 8," Cook wrote at the time.

Cook as recently as Tuesday reiterated Apple's commitment to maintaining user privacy for features such as the company's mobile payments service, Apple Pay. Neither merchants nor Apple store your credit card number, and Apple doesn't track what you've purchased.

"We believe that customers have a right to privacy," Cook said Tuesday during the Goldman Sachs technology conference. "The vast majority of customers don't want everyone knowing everything about them...You are not our product."

And Thursday, Apple said it was strengthening the log-in process for its iMessage and FaceTime digital communications services with the aim of preventing hackers from hijacking users' accounts. It added two-step identity verification to users' accounts, stopping unauthorized people from accessing accounts, even if they know the user's password. Apple has been beefing up the security of its Internet products since last year's high-profile breaching of iCloud accounts belonging to celebrities who use the service.

Cook on Friday said Apple Pay "will be available for many transactions with the federal government," such as paying for admission to national parks.