diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index d3904f2f6d3246ada5ff3454e2e6010790e951a9..bde0b094b87ec074f5ecc1fb2d485450bf6693d7 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -141,6 +141,7 @@
 				name: name,
 				displayName: action.displayName,
 				mime: mime,
+				order: action.order || 0,
 				icon: action.icon,
 				permissions: action.permissions,
 				type: action.type || FileActions.TYPE_DROPDOWN
@@ -565,6 +566,7 @@
 			this.registerAction({
 				name: 'Download',
 				displayName: t('files', 'Download'),
+				order: -20,
 				mime: 'all',
 				permissions: OC.PERMISSION_READ,
 				icon: function () {
@@ -596,6 +598,7 @@
 				name: 'Rename',
 				displayName: t('files', 'Rename'),
 				mime: 'all',
+				order: -30,
 				permissions: OC.PERMISSION_UPDATE,
 				icon: function() {
 					return OC.imagePath('core', 'actions/rename');
@@ -617,6 +620,7 @@
 				name: 'Delete',
 				displayName: t('files', 'Delete'),
 				mime: 'all',
+				order: 1000,
 				// permission is READ because we show a hint instead if there is no permission
 				permissions: OC.PERMISSION_DELETE,
 				icon: function() {
diff --git a/apps/files/js/fileactionsmenu.js b/apps/files/js/fileactionsmenu.js
index 5ab0e42f93ee3b331a69959d96495c036156a969..67cbb48c9651988347410f5ea81462baa02a2cec 100644
--- a/apps/files/js/fileactionsmenu.js
+++ b/apps/files/js/fileactionsmenu.js
@@ -100,6 +100,14 @@
 					(!defaultAction || actionSpec.name !== defaultAction.name)
 				);
 			});
+			items = items.sort(function(actionA, actionB) {
+				var orderA = actionA.order || 0;
+				var orderB = actionB.order || 0;
+				if (orderB === orderA) {
+					return OC.Util.naturalSortCompare(actionA.displayName, actionB.displayName);
+				}
+				return orderA - orderB;
+			});
 			items = _.map(items, function(item) {
 				item.nameLowerCase = item.name.toLowerCase();
 				return item;
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 8eaae74d3c30a0e9cecef833fa78be0e0fca6c6d..e4a7aadd600ebae398079e65b2f73afd5f35904c 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -302,6 +302,7 @@
 					name: 'Details',
 					displayName: t('files', 'Details'),
 					mime: 'all',
+					order: -50,
 					icon: OC.imagePath('core', 'actions/details'),
 					permissions: OC.PERMISSION_READ,
 					actionHandler: function(fileName, context) {
diff --git a/apps/files/tests/js/fileactionsmenuSpec.js b/apps/files/tests/js/fileactionsmenuSpec.js
index 0cfd12a2d04754f702b7e57872fb9eadbb266e66..dee542458b625df72ed907da65952ca3a25d0056 100644
--- a/apps/files/tests/js/fileactionsmenuSpec.js
+++ b/apps/files/tests/js/fileactionsmenuSpec.js
@@ -152,6 +152,43 @@ describe('OCA.Files.FileActionsMenu tests', function() {
 			expect(menu.$el.find('a[data-action=Match]').length).toEqual(1);
 			expect(menu.$el.find('a[data-action=NoMatch]').length).toEqual(0);
 		});
+		it('sorts by order attribute, then name', function() {
+			fileActions.registerAction({
+				name: 'Baction',
+				displayName: 'Baction',
+				order: 2,
+				mime: 'text/plain',
+				permissions: OC.PERMISSION_ALL
+			});
+			fileActions.registerAction({
+				name: 'Zaction',
+				displayName: 'Zaction',
+				order: 1,
+				mime: 'text/plain',
+				permissions: OC.PERMISSION_ALL
+			});
+			fileActions.registerAction({
+				name: 'Yaction',
+				displayName: 'Yaction',
+				mime: 'text/plain',
+				permissions: OC.PERMISSION_ALL
+			});
+			fileActions.registerAction({
+				name: 'Waction',
+				displayName: 'Waction',
+				mime: 'text/plain',
+				permissions: OC.PERMISSION_ALL
+			});
+
+			menu.render();
+			var zactionIndex = menu.$el.find('a[data-action=Zaction]').closest('li').index();
+			var bactionIndex = menu.$el.find('a[data-action=Baction]').closest('li').index();
+			expect(zactionIndex).toBeLessThan(bactionIndex);
+
+			var wactionIndex = menu.$el.find('a[data-action=Waction]').closest('li').index();
+			var yactionIndex = menu.$el.find('a[data-action=Yaction]').closest('li').index();
+			expect(wactionIndex).toBeLessThan(yactionIndex);
+		});
 	});
 
 	describe('action handler', function() {