If something happens to your phone, you'll get an automatic backup through Apple's iCloud service.

The memory on your phone, iPad, or Mac is more ephemeral than the memory on the iCloud.

If you want to remove a picture from your phone, you have to do it from the cloud.

There are a few ways to remove photos from your phone but keep them in the cloud.

How to delete photos off your iPhone without deleting them from iCloud

You can turn your iCloud backup off.

Turn off iCloud photo sharing

You can open the settings on your phone.

There are two You can tap on your name.

There are three. It's possible to tap on the cloud.

There are four. You can tap on photos.

There are five. It will go from green to gray when you turn it off.

The “iCloud Photos” settings on iPhone, with the toggle for “iCloud Photos” highlighted.
Turn off iCloud photo sharing.
Stefan Ionescu

There are six. If you enable the option to transfer a copy of the iCloud Photos folder onto your phone, you will see an option to do so. The iCloud originals will remain intact even if you choose to remove or download.

A pop-up on an iPhone that shows up when iCloud photo sharing is turned off while the “Optimize iPhone Storage” option is enabled.
Choose whether you want to copy the iCloud Photos folder to your phone.
Stefan Ionescu

The downside to this method is that if you connect your photos to iCloud, it will update to match your phone, deletions and all. You can use a different cloud server to back up your photos.

Use a server other than iCloud for photo backup 

There are many other cloud options you can choose from, including DropBox, which is why the example below is used.

This is the first thing. Go to the app store and download photos from the internet.

There are two If you allow access to all photos, you'll be able to see your photo gallery.

There are three. The pop-up will ask you for access to your photo gallery again. You can allow access to all photos.

There are four. Go to the next pop-up and decide if you'd like to get notifications from the photo service.

There are five. Pick the account you want to back up the photos to and then tap on the name of the account you want to back up.

There are six. The storage saver or original quality is what you choose for your backups. The former reduces the size of the images by reducing their quality, while the latter stores them in their original size and quality, whichever is better for you.

There are seven. If you scroll down and tap confirm, you'll get a backup of your pictures.

The Google Photos app on iPhone, with the “Confirm” button for backing up photos highlighted.
Confirm that you want to backup your photos to Google Photos.
Stefan Ionescu

If you want to know the progress of the backup, open the photos app and tap on your profile image on the top right corner.

If you want to keep a running iCloud sync to your phone but also keep a separate account for your photos, the last option is best.

Sign out of your current iCloud account, and sign into another one

This is the first thing. You can open the settings on your phone.

There are two You can tap on your name.

There are three. To sign out, scroll down to the bottom. You will be asked to confirm your identity.

The Apple ID settings on iPhone, with the “Sign Out” option highlighted at the bottom.
Sign out of the current iCloud account.
Stefan Ionescu

After you sign out, you will be asked which data you want to keep on your phone.

Signing into a separate account is now possible.

This is the first thing. The settings app needs to be opened.

There are two The Apple ID subheading can be found at the bottom of the screen.

There are three. You will be asked for your sign-in. The account you use to sign in will now be your sync account.